Skip to main content

Posts

SharePoint : Update URLs after resotring a content DB of hostnamed site collections

To change or update URLS after resotring a content DB of hostnamed site collections, use stsadm -o renamesite -oldurl http://abc.com -newurl http://abc-uat.com You only need to rename the root hostnamed site collection. It will reflect on the other HNSC starting with the same URL. If you try using Set-SPSiteURL on an HNSC with  same starting url, you will get the error : Could not perform this operation on the site collection http://abc.com. To add a URL for this site collection add a URL to the root host-named site collection at http://abc.com. At line:1 char:1

Correct way to handle exception for Get-SPWeb and Get-SpSite SharePoint PowerShell

Catch block does not work correctly for exceptions from get-spweb and get-spsite without the -ErrorAction Stop parameter.  This code will not print "in catch block"  try{Get-SPWeb 'wrong url'} catch { Write-Host "in catch block" }  correct usage : try{Get-SPWeb 'wrong url' -ErrorAction Stop } catch { Write-Host "in catch block" }

Access Host Web from App web in SharePoint hosted app - Office 365

Here is a snippet to save your day. There are many snippets out there showing you how to do cross domain calls, but none of them complete. Here is a sample to access host web components from a SharePoint hosted app or add in. Keywords: SharePoint, access host web, sharepoint online, JSOM, CSOM, SharePoint hosted app, Office 365. 'use strict'; //URLs var hostweburl; var appweburl; var context; var appContextSite; var factory; var context = SP.ClientContext.get_current(); var appContextSite; var rootweb ; var roleDefinitions ; (function () { $(document).ready(function () { hostweburl = decodeURIComponent(getQueryStringParameter("SPHostUrl")); appweburl = decodeURIComponent(getQueryStringParameter("SPAppWebUrl")); var scriptbase = hostweburl + "/_layouts/15/"; $.getScript(scriptbase + "SP.Runtime.js", function () { $('#message').append(" Getting Scripts.. "); ...

Azure Active Directory GraphClient AuthorizationException

Error : Microsoft.Azure.ActiveDirectory.GraphClient.AuthorizationException Insufficient privileges to complete the operation Solution: Under Configure under Permissions to other applications Add application - Windows Azure Active Directory Give the following permissions Read directory data Sign in and read user profile Stack Trace :  Microsoft.Azure.ActiveDirectory.GraphClient.AuthorizationException was unhandled by user code   HResult=-2146233088   Message=Insufficient privileges to complete the operation.   Source=Microsoft.Azure.ActiveDirectory.GraphClient   Code=Authorization_RequestDenied   ErrorMessage=Insufficient privileges to complete the operation.   ResponseUri=https://graph.windows.net/ /users/ ?api-version=2013-11-08   StackTrace:        at Microsoft.Azure.ActiveDirectory.GraphClient.ConnectionWrapper.InvokeNetworkOperation[T](Func`1 action)        at Microsoft.Az...

SharePoint : Access Denied when crawling mysites

Error Message: Access is denied. Verify that either the Default Content Access Account has access to this repository, or add a crawl rule to crawl this repository. If the repository being crawled is a SharePoint repository, verify that the account you are using has "Full Read" permissions on the SharePoint Web Application being crawled. Solution 1: Add backconnection host names in the registry under HKLM\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0 Add a Multi-String Value with name "BackConnectionHostNames". Add the host names for the sites that are on the local server. Solution 2: Disable loop-back check on the server  ( or add host name to Under "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa" Create a new 32bit DWORD value "DisableLoopbackCheck" with value as 1 Solution 3: Give your content access account "Retrieve People Data for Search Crawlers" permission on the user profile service application. ...