Skip to main content

Posts

Showing posts with the label SharePoint

Reset your SharePoint Farm PassPhrase

If you forgot or missed or want to change your SharePoint Farm PassPhrase, here are the Powershell commands. $PassPhrase = ConvertTo-SecureString -String “yourNewFarmPassPhrase” -asPlainText -Force Set-SPPassPhrase -PassPhrase $PassPhrase -Confirm Note: Comfirm your new PassPhrase and you are Done. To make sure everything work perfectly after PassPhrase reset, you need to reset the Configuration / Timer Cache from all the Servers in the Farm. Please check my article for the same here .

SharePoint log error "Cannot find site lookup info for request Uri http://"

There are many reasons for which you can have this error in your SharePoint server logs. One of the scenerio is explained below. Main Reason: One of the major reason for this error is; the SharePoint is not able to resolve the URL. There is something wrong with the alternate access mapping. Please make sure the alternate access mapping is configured properly. For more details on alternate access mapping in SharePoint, please visit: Alternate Access Mapping We had sharepoint 2016 and all website under that were https:// from the firewall. When we tried to load the web site, error occured with a Correlation Id. After checking the code I found the error message "Cannot find site lookup info for request Uri http://". I URL was able to authenticate the user but on page load the error occurs. My alternate access mapping was: https://mysite                                   ...

Get all the WorkflowTask associated with a ListItem

Sometimes, we need to access all the Task associated with an SPListItem for a particular workflow. Following quick code is helpful. //using the namespace using Microsoft.SharePoint.Workflow; SPSecurity.RunWithElevatedPrivileges(delegate                     {                         using(SPSite site = new SPSite(SPContext.Current.Web.Url))                         {                             using (SPWeb web = site.OpenWeb())                             {                                 SPList lsPM = web.Lists["MyList"];                   ...

Impersonate User in Sharepoint/MOSS 2007

We faced a strange problem in MOSS 2007 Application. A user need to access the SPUserCollection object of the Parent site where the user is having "Read" right only. We tried RunWithElevatePriviledges(), but it didn't work for us (Access denied exception). Finally came out with a solution where we impersonate the user account to the default sharepoint System Account using a UserToken object. Things started working fine. Sample code is pasted below. SPUser AdminUser = SPContext.Current.Web.AllUsers[@"SHAREPOINT\SYSTEM"]; //This is the default system account. var superToken = AdminUser.UserToken; //User Token Generated. //Now use this token and perform any operation from the object model. using (SPSite siteCollection = new SPSite(siteURL, superToken)) { //Some Operation } Hope this helped. Enjoy Coding .. ..