<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>SharePoint Recipes</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/sharepointrecipes/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/sharepointrecipes/feed.xml</link>
    <description />
    <lastBuildDate>Tue, 16 Apr 2019 06:16:22 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>SharePoint – Test-SPContentDatabase complains of Classic Mode database</title>
      <link>https://docs.microsoft.com/archive/blogs/sharepointrecipes/sharepoint-test-spcontentdatabase-complains-of-classic-mode-database</link>
      <pubDate>Thu, 18 Jun 2015 03:49:15 GMT</pubDate>
      <dc:creator><![CDATA[nirmas]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/sharepointrecipes/2015/06/18/sharepoint-test-spcontentdatabase-complains-of-classic-mode-database/</guid>
      <description><![CDATA[The Issue:

 Migrating SP 2010 classic content database to SP 2013 Claims web app. The...]]></description>
      <content:encoded><![CDATA[<p><span style="text-decoration:underline;"><strong>The Issue:
</strong></span></p><p>
 </p><p>Migrating SP 2010 classic content database to SP 2013 Claims web app. The Test-SPContentdatabase command complains that the database is still in classic mode.
</p><p>
 </p><p><span style="text-decoration:underline;"><strong>Steps that were performed: 
</strong></span></p><p>
 </p><p>•    Created a new classic web app from PS - <a href="http://SPWEB:8080">http://SPWEB:8080</a><br />•    Mounted the 2010 database.<br />•    Post this we followed steps on the TechNet - Migrate from classic-mode to claims-based authentication in SharePoint 2013 <a href="http://technet.microsoft.com/en-us/library/gg251985.aspx">http://technet.microsoft.com/en-us/library/gg251985.aspx</a>
	</p><p>        <span style="font-size:9pt;">$WebAppName = &quot;http:// SPWEB:8080&quot; <br />        $wa = get-SPWebapplication $WebAppName <br />        $wa.UseClaimsAuthentication = $true <br />        $wa.Update() 
</span></p><p><span style="font-size:9pt;">        $account = &quot;yourDomain\yourUser&quot; <br />        $account = (New-SPClaimsPrincipal -identity $account -identitytype 1).ToEncodedString() <br />        $wa = get-SPWebApplication $WebAppName <br />        $zp = $wa.ZonePolicies(&quot;Default&quot;) <br />        $p = $zp.Add($account,&quot;PSPolicy&quot;) <br />        $fc=$wa.PolicyRoles.GetSpecialRole(&quot;FullControl&quot;) <br />        $p.PolicyRoleBindings.Add($fc) <br />        $wa.Update() 
</span></p><p><span style="font-size:9pt;">        $wa.MigrateUsers($true) <br />        $wa.ProvisionGlobally()<br /></span>        
</p><p>•    Post this the test-SPContentDatabase was still showing inconsistency.<br />•    We then performed this cleanup : We wanted to remove any account that no longer existed in AD.<br />•    Ran the below PS script to identify inactive users in the site collection [by comparing them to AD].
</p><p>
 </p><p><span style="font-size:9pt;">        $web = get-spweb &quot;http://SPWEB:8080/sites/sitecollection&quot; <br />        $allusers = $web.siteusers <br />        $array = @() <br />        foreach($user in $allusers) <br />        { <br />        $login_full = $user.UserLogin <br />        $elements = $login_full.split(&quot;\&quot;) <br />        $login = $elements[1] <br />        $ds = New-Object System.DirectoryServices.DirectorySearcher <br />        $filter = &quot;(&amp;(objectCategory=User)(sAMAccountname=&quot; + $login + &quot;))&quot; <br />        $ds.Filter = $filter <br />        if ($de = $ds.findone()) {write-host $login_full &quot;User enabled&quot;} <br />        else <br />        { <br />        write-host $login_full &quot;User disabled&quot; <br />        $array+=$login_full <br />        } <br />        } <br />        $array &gt;path\fiIe.txt
</span></p><p>        
</p><p>•    From the output file, removed the SharePoint built in accounts and verified that the users are the ones missing from AD. Then fed the modified output file to the next script to remove such users: 
</p><p>
 </p><p>        <span style="font-size:9pt;"># Remove Pre-DefÌned Users   <br />        $users = get-content -path &quot;path\fiIe.txt&quot;   <br />        $web = get-spweb http://SPWEB:8080/sites/sitecollection  <br />        $allusers = $web.siteusers   <br />        foreach($temp in $ users)   <br />        {   <br />        write-host $temp &quot;needs to be removed&quot;   <br />        remove-spuser -Id $temp -web $web -Confirm:$false   <br />        } </span>
	</p><p>
 </p><p>•    Post this, we checked the output of the below SQL query : We wanted to check if there are any admin accounts still listed in the database using Classic Format.
</p><p>
 </p><p><span style="font-size:10pt;">SELECT TOP 100 [tp_SiteID],[tp_Login] FROM [UserInfo] WITH (NOLOCK) WHERE tp_IsActive = 1 AND tp_SiteAdmin = 1 AND tp_Deleted = 0 and tp_Login not LIKE &#39;i:%&#39; <br /><br />This returned two entries, which were causing the error : <br /></span><span style="font-size:9pt;">tp_SiteID tp_Login     <br />SiteID_GUID1 c:0+.w|SID1    <br />SITEID_GUID2 c:0+.w|SID2</span><span style="font-size:10pt;">
		</span></p><p>
 </p><p>•    Using PowerShell, we figured that these SIDs were AD groups: 
</p><p>
 </p><p><span style="font-size:9pt;">Domain\GRP1 <br />Domain\GRP2
</span></p><p>
 </p><p>•    We removed these two groups from SharePoint and then the test-spcontentdatabase no longer complains about claims and classic inconsistency</p>]]></content:encoded>
    </item>
    <item>
      <title>SharePoint – PSConfig Failure IdentityNotMappedException</title>
      <link>https://docs.microsoft.com/archive/blogs/sharepointrecipes/sharepoint-psconfig-failure-identitynotmappedexception</link>
      <pubDate>Thu, 18 Jun 2015 03:24:00 GMT</pubDate>
      <dc:creator><![CDATA[nirmas]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/sharepointrecipes/2015/06/18/sharepoint-psconfig-failure-identitynotmappedexception/</guid>
      <description><![CDATA[The Issue: 
&nbsp;
Unable to create a new farm PSConfig fails with...]]></description>
      <content:encoded><![CDATA[<p><span style="text-decoration:underline;"><strong>The Issue: </strong></span></p>
<p>&nbsp;</p>
<p>Unable to create a new farm PSConfig fails with System.Security.Principal.IdentityNotMappedException.</p>
<p>&nbsp;</p>
<p><span style="text-decoration:underline;"><strong>Behind the Scene: </strong></span></p>
<p>&nbsp;</p>
<p>Error in Logs:</p>
<p>&nbsp;</p>
<p><span style="font-size:9pt;"> [DATE] 13:11:35 9 ERR Task configdb has failed with an unknown exception <br />[DATE] 13:11:35 9 ERR Exception: System.Security.Principal.<span style="background-color:yellow;"><strong>IdentityNotMappedException</strong></span>: Some or all identity references could not be translated. <br /> at System.Security.Principal.<span style="background-color:yellow;"><strong>NTAccount.Translate</strong></span>(IdentityReferenceCollection sourceAccounts, Type targetType, Boolean forceSuccess) <br /> at System.Security.Principal.NTAccount.Translate(Type targetType) <br /> at System.Security.AccessControl.CommonObjectSecurity.ModifyAccess(AccessControlModification modification, AccessRule rule, Boolean&amp; modified) <br /> at System.Security.AccessControl.CommonObjectSecurity.AddAccessRule(AccessRule rule) <br /> at Microsoft.SharePoint.Administration.Claims.SPSecurityTokenServiceCertificate.ProvisionLocal() <br /> at Microsoft.SharePoint.Administration.Claims.<span style="background-color:yellow;"><strong>SPSecurityTokenServiceApplication.ProvisionLocal</strong></span>(SPServiceInstance serviceInstance) <br /> at Microsoft.SharePoint.Administration.<span style="background-color:yellow;"><strong>SPIisWebServiceInstance.Provision</strong></span>() <br /> at Microsoft.SharePoint.Administration.<span style="background-color:yellow;"><strong>SPFarm.Join</strong></span>(Boolean skipRegisterAsDistributedCacheHost) <br /> at Microsoft.SharePoint.PostSetupConfiguration.<span style="background-color:yellow;"><strong>ConfigurationDatabaseTask.CreateOrConnectConfigDb</strong></span>() <br /> at Microsoft.SharePoint.PostSetupConfiguration.ConfigurationDatabaseTask.Run() <br /> at Microsoft.SharePoint.PostSetupConfiguration.TaskThread.ExecuteTask() </span></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>Below is what we are seeing: <strong>The problem was rooted outside of SharePoint, in IIS. We proved that with below steps.</strong></p>
<p>&nbsp;</p>
<p>+ In IIS, create a new app pool. Use a local admin domain account as the app pool identity. In the below example the App Pool is named &quot;SecurityTokenServiceApplicationPool&quot; <br />+ Run the below commands in PowerShell :</p>
<p>&nbsp;</p>
<p><span style="font-size:9pt;">$NTAccount = new-object System.Security.Principal.NTAccount(&#39;IIS APPPOOL\SecurityTokenServiceApplicationPool&#39;) <br />$TranslatedToSidObject = $NTAccount.Translate( [System.Security.Principal.SecurityIdentifier]) <br />$SID = New-Object System.Security.Principal.SecurityIdentifier($TranslatedToSidObject.Value) <br />$TranslatedToNTAccount = $SID.Translate([System.Security.Principal.NTAccount]) <br />Write-host $TranslatedToSidObject.Value `t`t $TranslatedToNTAccount.Value </span></p>
<p>&nbsp;</p>
<p>+ We will see failure in the commands on affected box, while it works in other environments:</p>
<p>&nbsp;</p>
<p><span style="font-size:9pt;">$NTAccount = new-object System.Security.Principal.NTAccount(&#39;IIS APPPOOL\SecurityTokenServiceApplicationPool&#39;) <br />$TranslatedToSidObject = $NTAccount.Translate( [System.Security.Principal.SecurityIdentifier]) <br />Exception calling &quot;Translate&quot; with &quot;1&quot; argument(s): &quot;Some or all identity references could not be translated.&quot; <br />At line:1 char:1 <br />+ $TranslatedToSidObject = $NTAccount.Translate( [System.Security.Principal.Securi ... <br />+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException <br />+ FullyQualifiedErrorId : IdentityNotMappedException </span></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><span style="text-decoration:underline;"><strong>How this was fixed:</strong></span></p>
<p>&nbsp;</p>
<p>The problem was that the Application Host Helper Service (AppHostSvc) wasn&#39;t running. The accounts were getting created just fine when we went to use the app pool (like browse the default web site using the app pool). <br />WAS makes sure the accounts are created and the rights are assigned when it goes to start a worker process. <br />The AppHostSvc, though, will create the account when you simply add the app pool to the config, whether you&#39;re using it yet or not.<br />This service was set to manual start. We started it and everything worked as expected. PSConfig completed.</p>]]></content:encoded>
    </item>
    <item>
      <title>SharePoint – AppFabric PreRequisite Installer fail 1603</title>
      <link>https://docs.microsoft.com/archive/blogs/sharepointrecipes/sharepoint-appfabric-prerequisite-installer-fail-1603</link>
      <pubDate>Wed, 17 Jun 2015 23:14:00 GMT</pubDate>
      <dc:creator><![CDATA[nirmas]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/sharepointrecipes/2015/06/17/sharepoint-appfabric-prerequisite-installer-fail-1603/</guid>
      <description><![CDATA[The Issue: 
&nbsp;
AppFabric installation was failing with &quot;AppFabric installation failed...]]></description>
      <content:encoded><![CDATA[<p><span style="text-decoration:underline;"><strong>The Issue: </strong></span></p>
<p>&nbsp;</p>
<p>AppFabric installation was failing with &quot;AppFabric installation failed because installer MSI returned with error code : 1603&quot; Error.</p>
<p>&nbsp;</p>
<p><span style="text-decoration:underline;"><strong>Behind the Scenes: </strong></span></p>
<p>&nbsp;</p>
<p>We looked at logs located at -&gt; %temp%</p>
<p style="margin-left:36pt;"><span style="font-size:9pt;">prerequisiteinstaller.&lt;datetime&gt;.log<br />AppServerSetup1_1_CustomActions&lt;datetime&gt;.log<br />AppServerSetup1_1&lt;datetime&gt;.log<br />AppServerSetup&lt;datetime&gt;.log<br />AppServerSetup&lt;datetime&gt;.err</span></p>
<p>These were the errors in Pre Requisite Installer Log:</p>
<p style="margin-left:36pt;">&nbsp;</p>
<p style="margin-left:36pt;"><span style="font-size:9pt;">[Date] 21:37:44 - All services have been configured successfully after AppFabric installation<br />[Date] 21:37:44 - Last return code (0X643=1603)<br />[Date] 21:37:44 - Reading the following DWORD value/name...<br />[Date] 21:37:44 &ndash; Flags<br />[Date] 21:37:44 - from the following registry location...<br />[Date] 21:37:44 - SOFTWARE\Microsoft\Updates\UpdateExeVolatile<br />[Date] 21:37:44 - Reading the following string value/name...<br />[Date] 21:37:44 &ndash; PendingFileRenameOperations<br />[Date] 21:37:44 - from the following registry location...<br />[Date] 21:37:44 - SYSTEM\CurrentControlSet\Control\Session Manager<br />[Date] 21:37:44 - Reading the following registry location...<br />[Date] 21:37:44 - SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired<br />[Date] 21:37:44 - Error: The tool was unable to install Windows Server AppFabric.<br />[Date] 21:37:44 - Last return code (0X643=1603) </span></p>
<p>&nbsp;</p>
<p>Below errors were interesting in AppServerSetup1_1_CustomActions&lt;datetime&gt;.log</p>
<p>&nbsp;</p>
<p><span style="font-size:9pt;">&lt;datetime&gt; EXEPATH=powershell.exe PARAMS=-command &quot;$content = Get-Content \&quot;c:\Program Files\AppFabric 1.1 for Windows Server\\AppFabricServer.xml\&quot;; $content = ForEach-Object -InputObject $content { $_ -replace \&quot;INSTALLPATH\&quot;, \&quot;c:\Program Files\AppFabric 1.1 for Windows Server\\\&quot; }; Set-Content -value $content -path \&quot;c:\Program Files\AppFabric 1.1 for Windows Server\\AppFabricServer.xml\&quot; &quot; LOGFILE=C:\Users\Account\AppData\Local\Temp\AppServerSetup1_1_CustomActions(datetime).log </span></p>
<p><span style="font-size:9pt;">ExitCode=0 </span></p>
<p><span style="font-size:9pt;">&lt;datetime&gt; EXEPATH=powershell.exe PARAMS=-command &quot;$content = Get-Content \&quot;c:\Program Files\AppFabric 1.1 for Windows Server\\Consolidator.xml\&quot;; $content = ForEach-Object -InputObject $content { $_ -replace \&quot;INSTALLPATH\&quot;, \&quot;c:\Program Files\AppFabric 1.1 for Windows Server\\\&quot; }; Set-Content -value $content -path \&quot;c:\Program Files\AppFabric 1.1 for Windows Server\\Consolidator.xml\&quot; &quot; LOGFILE=C:\Users\Account\AppData\Local\Temp\AppServerSetup1_1_CustomActions(datetime).log </span></p>
<p><span style="font-size:9pt;">ExitCode=0 </span></p>
<p><span style="font-size:9pt;">Executing action : Microsoft.ApplicationServer.InstallHelper.SQMTaskInstallAction </span></p>
<p><span style="font-size:9pt;">SQMTaskInstall areguments - /create /tn &quot;\Microsoft\Windows\AppFabric\Customer Experience Improvement Program\Consolidator&quot; /xml &quot;c:\Program Files\AppFabric 1.1 for Windows Server\Consolidator.xml&quot; </span></p>
<p>&nbsp;</p>
<p><span style="font-size:9pt;">Error: ERROR: The network address is invalid.<br /><span style="background-color:yellow;"><strong>The setup needs to add a scheduled task for customer experience program, but that fails if the task scheduler service is not running.<br />This could also fail if the task already exists with error : &quot;ERROR: Cannot create a file when that file already exists&quot;</strong></span> </span></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><span style="text-decoration:underline;"><strong>Resolution: </strong></span></p>
<p>&nbsp;</p>
<p>For - &quot;ERROR: The network address is invalid&quot; -&gt; Ensure the Task Scheduler Windows Service is running.</p>
<p>For - &quot;ERROR: Cannot create a file when that file already exists&quot; -&gt; Delete the task &quot;Consolidator&quot; in &quot;%SYSTEM32%\Tasks\Microsoft\Windows\AppFabric\Customer Experience Improvement Program&quot; and re run the installation.</p>
<p>Note -</p>
<p style="margin-left:36pt;">- Even if the file exists the Task Scheduler UI does not show it<br />- The file seems to be left there by a previous AppFabric installation<br />- The setup creates it even if the CU choose to do not join the Customer Experience program<br />- There are other reasons why we may fail on this installer &ndash; refer <a href="/b/praveenh/archive/2013/02/22/sharepoint-2013-prerequisites-fails-with-msi-installer-error-code-1603-while-installing-appfabric-1-1.aspx">here</a>.</p>]]></content:encoded>
    </item>
    <item>
      <title>SharePoint – Unable to create any site collection</title>
      <link>https://docs.microsoft.com/archive/blogs/sharepointrecipes/sharepoint-unable-to-create-any-site-collection</link>
      <pubDate>Wed, 17 Jun 2015 22:13:52 GMT</pubDate>
      <dc:creator><![CDATA[nirmas]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/sharepointrecipes/2015/06/17/sharepoint-unable-to-create-any-site-collection/</guid>
      <description><![CDATA[The Issue:
We are unable to create any site collections. We see error &quot;This page has...]]></description>
      <content:encoded><![CDATA[<p><span style="text-decoration:underline;"><strong>The Issue:
</strong></span></p><p>We are unable to create any site collections. We see error &quot;This page has encountered a critical error. Contact your system administrator if this problem persists&quot;.
</p><p>
 </p><p><span style="text-decoration:underline;"><strong>What we see in the logs:
</strong></span></p><p>
 </p><p>• Site collection creation was failing because of the below stack as per ULS logs: 
</p><p>
 </p><p><span style="font-size:9pt;">[DATE] 09:36:39.25 w3wp.exe (PID) TID Document Management Server Document Sets 55r4 Unexpected 
</span></p><p><span style="font-size:9pt;">DocumentSet FeatureActivating: throws exception: This page has encountered a critical error. Contact your system administrator if this problem persists.. Stacktrace: <br />at Microsoft.SharePoint.ApplicationRuntime.SafeControls.IsSafeControl(Boolean isAppWeb, Type type, String&amp; unsafeErrorMessage) <br />at Microsoft.SharePoint.WebPartPages.TypeCache.CheckIfSafeControl(Type type, Boolean isAppWeb) <br />at Microsoft.SharePoint.WebPartPages.TypeCache.get_Item(Type type, Boolean isAppWeb, Boolean disableSafeControlsCheck)<br />at Microsoft.SharePoint.WebPartPages.WebPart.WriteXmlGlobal(Boolean disableSafeControlsCheck) <br />at Microsoft.SharePoint.WebPartPages.BinaryWebPartSerializer.Serialize(SerializationMode mode, BinaryWebPartSerializerFlag binaryWebPartSerializerFlags, BinaryWebPartSerializerWriter writer) <br />at Microsoft.SharePoint.WebPartPages.BinaryWebPartSerializer.Serialize(SerializationMode mode, BinaryWebPartSerializerFlag binaryWebPartSerializerFlags) <br />at Microsoft.SharePoint.WebPartPages.SPWebPartManager.AddWebPartToStore(WebPart webPart, Int32 viewId, String viewGuid)<br />at Microsoft.SharePoint.WebPartPages.SPWebPartManager.AddWebPartInternal(SPSupersetWebPart superset, Boolean throwIfLocked) <br />at Microsoft.SharePoint.WebPartPages.SPLimitedWebPartManager.AddWebPart(WebPart webPart, String zoneId, Int32 zoneIndex) <br />at Microsoft.Office.DocumentManagement.Internal.DocumentSetFeatureReceiver.FeatureActivated(SPFeatureReceiverProperties properties) <br />at Microsoft.SharePoint.SPFeature.DoActivationCallout(Boolean fActivate, Boolean fForce) <br />at Microsoft.SharePoint.SPFeature.Activate(SPSite siteParent, SPWeb webParent, SPFeaturePropertyCollection props, SPFeatureActivateFlags activateFlags, Boolean fForce) <br />at Microsoft.SharePoint.SPFeatureCollection.AddInternal(SPFeatureDefinition featdef, Version version, SPFeaturePropertyCollection properties, SPFeatureActivateFlags activateFlags, Boolean force, Boolean fMarkOnly) <br />at Microsoft.SharePoint.SPFeatureCollection.AddInternalWithName(Guid featureId, Int32 compatibilityLevel, String featureName, Version version, SPFeaturePropertyCollection properties, SPFeatureActivateFlags activateFlags, Boolean force, Boolean fMarkOnly, SPFeatureDefinitionScope featdefScope) <br />at Microsoft.SharePoint.SPFeatureCollection.AddInternal(Guid featureId, Version version, SPFeaturePropertyCollection properties, Boolean force, Boolean fMarkOnly, SPFeatureDefinitionScope featdefScope) <br />at Microsoft.Office.DocumentManagement.VideoAndRichMedia.Internal.VideoAndRichMediaFeatureReceiver.FeatureActivated(SPFeatureReceiverProperties properties) <br />at Microsoft.SharePoint.SPFeature.DoActivationCallout(Boolean fActivate, Boolean fForce) <br />at Microsoft.SharePoint.SPFeature.Activate(SPSite siteParent, SPWeb webParent, SPFeaturePropertyCollection props, SPFeatureActivateFlags activateFlags, Boolean fForce) <br />at Microsoft.SharePoint.SPFeatureCollection.AddInternal(SPFeatureDefinition featdef, Version version, SPFeaturePropertyCollection properties, SPFeatureActivateFlags activateFlags, Boolean force, Boolean fMarkOnly) <br />at Microsoft.SharePoint.SPTemplateAssociationElement.EnsureTemplateAssociatedSiteFeaturesActivated(SPSite site, String sTemplateName) <br />at Microsoft.SharePoint.SPFeatureManager.&lt;&gt;c__DisplayClass16.b__15() <br />at Microsoft.SharePoint.SPSecurity.RunAsUser(SPUserToken userToken, Boolean bResetContext, WaitCallback code, Object param) <br />at Microsoft.SharePoint.SPFeatureManager.EnsureTemplateAssociatedSiteFeaturesActivated(Byte[]&amp; userToken, Guid&amp; tranLockerId, Int32 nZone, Guid databaseid, Guid siteid, String sTemplateName) <br />at Microsoft.SharePoint.ApplicationRuntime.SafeControls.IsSafeControl(Boolean isAppWeb, Type type, String&amp; unsafeErrorMessage) <br />at Microsoft.SharePoint.WebPartPages.TypeCache.CheckIfSafeControl(Type type, Boolean isAppWeb) <br />at Microsoft.SharePoint.WebPartPages.TypeCache.get_Item(Type type, Boolean isAppWeb, Boolean disableSafeControlsCheck)<br />at Microsoft.SharePoint.WebPartPages.WebPart.WriteXmlGlobal(Boolean disableSafeControlsCheck) <br />at Microsoft.SharePoint.WebPartPages.BinaryWebPartSerializer.Serialize(SerializationMode mode, BinaryWebPartSerializerFlag binaryWebPartSerializerFlags, BinaryWebPartSerializerWriter writer) <br />at Microsoft.SharePoint.WebPartPages.BinaryWebPartSerializer.Serialize(SerializationMode mode, BinaryWebPartSerializerFlag binaryWebPartSerializerFlags) <br />at Microsoft.SharePoint.WebPartPages.SPWebPartManager.AddWebPartToStore(WebPart webPart, Int32 viewId, String viewGuid) <br />at Microsoft.SharePoint.WebPartPages.SPWebPartManager.AddWebPartInternal(SPSupersetWebPart superset, Boolean throwIfLocked) <br />at Microsoft.SharePoint.WebPartPages.SPLimitedWebPartManager.AddWebPart(WebPart webPart, String zoneId, Int32 zoneIndex) <br />at Microsoft.Office.DocumentManagement.Internal.DocumentSetFeatureReceiver.FeatureActivated(SPFeatureReceiverProperties properties). 
</span></p><p>
 </p><p>• We can see that the failure was while activating the feature called &quot;DocumentSet&quot;. In this process, it attempts to check if the feature is a SafeControl – for which it would need to look at the web.config file of the web application in IIS. 
</p><p>• <strong><em>This is when we found that the affected web applications had no files in the IIS virtual directory on the server</em></strong>. They were missing, which was causing the unexpected error at site collection creation. 
</p><p> 
 </p><p> 
 </p><p><span style="text-decoration:underline;"><strong>How did we fix this? 
</strong></span></p><p>
 </p><p>• We provisioned these web applications to bring back these files: 
</p><p>
 </p><p>    <span style="font-size:9pt;"><strong><em>Add-pssnapin microsoft.sharepoint.powershell <br />    $contentservice = [Microsoft.sharepoint.Administration.spwebservice]::contentservice <br />    $webapp = $contentservice.webapplications | where { $_.name -match &quot;WEB_APP_NAME&quot; } <br />    $webapp.provision() 
</em></strong></span></p><p>
 </p><p>• After this, we were able to create site collections on the re-provisioned web application. We tested creating a new web application, but that was timing out. So we did this on the central admin application pool in IIS: 
</p><p>
 </p><p><span style="font-size:9pt;"><strong><em>IIS Manager &gt; App Pool &gt; Central Admin App Pool &gt; Shut Down Limit &gt; Changed this from 90 seconds to 600 Seconds 
</em></strong></span></p><p>
 </p><p>• After this we were able to create web applications from central admin site successfully. <br />• We also noticed that web application creation was taking unusually long to complete. One tip to improve the performance would be to disable Receive Side Scaling and TCP Offloads on the SharePoint and SQL Servers. This is explained in the article below: 
</p><p>
 </p><p style="margin-left:36pt;"><strong><em><span style="font-size:9pt;">Information about the TCP Chimney Offload, Receive Side Scaling - <a href="http://support.microsoft.com/kb/951037">http://support.microsoft.com/kb/951037</a>
				</span>
			</em></strong></p><p>
 </p><p>• It is likely that a timed out web application create command is what caused this issue in the first place.<br />• You would need to disable the settings both at the NIC Card level as well as from command prompt on both SharePoint and SQL servers.<br />• Please be aware that this would cause a temporary network outage on the servers, so it is best to schedule this for a downtime in the environment.</p>]]></content:encoded>
    </item>
    <item>
      <title>SharePoint – Cannot open Office documents in Client</title>
      <link>https://docs.microsoft.com/archive/blogs/sharepointrecipes/sharepoint-cannot-open-office-documents-in-client</link>
      <pubDate>Wed, 17 Jun 2015 21:45:31 GMT</pubDate>
      <dc:creator><![CDATA[nirmas]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/sharepointrecipes/2015/06/17/sharepoint-cannot-open-office-documents-in-client/</guid>
      <description><![CDATA[The Issue:
We are not able to open office documents in a new web application. We get the following...]]></description>
      <content:encoded><![CDATA[<p><span style="text-decoration:underline;"><strong>The Issue:
</strong></span></p><p><br />We are not able to open office documents in a new web application. We get the following error:  &quot;Sorry we cannot open &#39;URL.xxx document&#39;&quot;
</p><p><br /><span style="text-decoration:underline;"><strong>What we see in the Logs:
</strong></span></p><p><br />• Below is what we saw in IIS for the working scenario: 
</p><p>
 </p><p><span style="font-size:9pt;">[DATE] 21:58:09 s-ip OPTIONS /SiteCollection/Shared+Documents/ - 443 - c-ip Microsoft+Office+Word+2013 401 0 0 64 <br />[DATE] 21:58:59 s-ip OPTIONS /SiteCollection/Shared+Documents/ - 443 - c-ip Microsoft+Office+Word+2013 401 1 2148074254 2 <br />[DATE] 21:58:59 s-ip <span style="background-color:lime;"><strong>OPTIONS</strong></span> /SiteCollection/Shared+Documents/ - 443 domain\user c-ip Microsoft+Office+Word+2013 <span style="background-color:lime;"><strong>200</strong></span> 0 0 80 <br />[DATE] 21:58:59 s-ip POST /SiteCollection/_vti_bin/cellstorage.svc/CellStorageService - 443 - c-ip Microsoft+Office+Word+2013 401 1 2148074254 11 <br />[DATE] 21:58:59 s-ip POST /_vti_bin/cellstorage.https.svc/cellstorageservice - 443 domain\user c-ip Microsoft+Office+Word+2013 200 0 0 607 <br />[DATE] 21:59:01 s-ip POST /_vti_bin/cellstorage.https.svc/cellstorageservice - 443 domain\user c-ip Microsoft+Office+Word+2013 200 0 0 834 
</span></p><p><br />• Below is what we saw in IIS for the non-working scenario: 
</p><p>
 </p><p><span style="font-size:9pt;">[DATE] 22:07:53 s-ip <span style="background-color:yellow;"><strong>OPTIONS</strong></span> /sites/SiteCollection/Shared+Documents/ - 443 - c-ip Microsoft+Office+Word+2013+(15.0.4517)+Windows+NT+6.2 <span style="background-color:yellow;"><strong>500</strong></span> 0 64 2 <br />[DATE] 22:07:53 s-ip OPTIONS /sites/SiteCollection/Shared+Documents/ - 443 - c-ip Microsoft+Office+Word+2013+(15.0.4517)+Windows+NT+6.2 403 16 2148204809 17 <br />[DATE] 22:07:53 s-ip <span style="background-color:yellow;"><strong>OPTIONS</strong></span> /sites/SiteCollection/Shared+Documents/ - 443 - c-ip Microsoft+Office+Word+2013+(15.0.4517)+Windows+NT+6.2 <span style="background-color:yellow;"><strong>403</strong></span> 16 2148204809 15 <br />[DATE] 22:07:53 s-ip HEAD /sites/SiteCollection/Shared+Documents/BrokenDocument.docx - 443 - c-ip Microsoft+Office+Word+2013+(15.0.4517)+Windows+NT+6.2 403 16 2148204809 15 <br />[DATE] 22:07:53 s-ip GET /sites/SiteCollection/Shared+Documents/BrokenDocument.docx - 443 - c-ip Mozilla/4.0+(compatible;+MSIE+7.0;+Windows+NT+6.2;+Win64;+x64;+Trident/6.0;+.NET4.0E;+.NET4.0C;+.NET+CLR+3.5.30729;+.NET+CLR+3.0.30729;+.NET+CLR+2.0.50727;+InfoPath.3;+ms-office;+MSOffice+15) 403 16 2148204809 57 
</span></p><p>
 </p><p>• The OPTIONS request never gets authenticated in the non-working scenario. <br />• We captured failed request tracing logs for 403 and 500 and below is what we saw: 
</p><p>
 </p><p>This is for the 500: 
</p><p>
 </p><p><span style="font-size:9pt;">20. NOTIFY_MODULE_START ModuleName=&quot;IsapiFilterModule&quot;, Notification=&quot;MAP_PATH&quot;, fIsPostNotification=&quot;false&quot; 22:25:29.868 <br />21. NOTIFY_MODULE_END ModuleName=&quot;IsapiFilterModule&quot;, Notification=&quot;MAP_PATH&quot;, fIsPostNotificationEvent=&quot;false&quot;, NotificationStatus=&quot;NOTIFICATION_CONTINUE&quot; 22:25:29.868 <br />22. MODULE_SET_RESPONSE_ERROR_STATUS <br />Warning ModuleName=&quot;IIS Web Core&quot;, Notification=&quot;BEGIN_REQUEST&quot;, HttpStatus=&quot;500&quot;, HttpReason=&quot;Internal Server Error&quot;, HttpSubStatus=&quot;0&quot;, ErrorCode=&quot;The I/O operation has been aborted because of either a thread exit or an application request. <br />(0x800703e3)&quot;, ConfigExceptionInfo=&quot;&quot; 22:25:29.868 
</span></p><p>
 </p><p>This is for the 403: 
</p><p>
 </p><p><span style="font-size:9pt;">20. NOTIFY_MODULE_START ModuleName=&quot;IsapiFilterModule&quot;, Notification=&quot;MAP_PATH&quot;, fIsPostNotification=&quot;false&quot; 22:25:29.913 <br />21. NOTIFY_MODULE_END ModuleName=&quot;IsapiFilterModule&quot;, Notification=&quot;MAP_PATH&quot;, fIsPostNotificationEvent=&quot;false&quot;, NotificationStatus=&quot;NOTIFICATION_CONTINUE&quot; 22:25:29.913 <br />22. MODULE_SET_RESPONSE_ERROR_STATUS <br />Warning ModuleName=&quot;IIS Web Core&quot;, Notification=&quot;BEGIN_REQUEST&quot;, <span style="background-color:yellow;"><strong>HttpStatus=&quot;403&quot;, HttpReason=&quot;Forbidden&quot;, HttpSubStatus=&quot;16&quot;, ErrorCode=&quot;A certificate chain processed, but terminated in a root certificate which is not trusted by the trust provider. <br />(0x800b0109)&quot;,</strong></span> ConfigExceptionInfo=&quot;&quot; 22:25:29.928 
</span></p><p>
 </p><p>• The 403 Errors were for client certificates.
</p><p>
 </p><p>
 </p><p><span style="text-decoration:underline;"><strong>How do we fix this?
</strong></span></p><p>
 </p><p>• We made this change on the affected site: 
</p><p>
 </p><p>IIS &gt; Site &gt; SSL Settings &gt; Client Certificates &gt; Set this to Ignore [this was set to Accept on the affected site]. 
</p><p>
 </p><p>• As soon as we made this change, Office documents from the affected site opened up in Office Client.</p>]]></content:encoded>
    </item>
    <item>
      <title>SharePoint Hung Crawl - Sandbox worker pool is closed</title>
      <link>https://docs.microsoft.com/archive/blogs/sharepointrecipes/sharepoint-hung-crawl-sandbox-worker-pool-is-closed</link>
      <pubDate>Wed, 17 Jun 2015 20:49:00 GMT</pubDate>
      <dc:creator><![CDATA[nirmas]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/sharepointrecipes/2015/06/17/sharepoint-hung-crawl-sandbox-worker-pool-is-closed/</guid>
      <description><![CDATA[The Issue:SharePoint continuous search crawl hangs. We see the below errors in the application event...]]></description>
      <content:encoded><![CDATA[<p><span style="text-decoration:underline;"><strong>The Issue:<br /></strong></span><br />SharePoint continuous search crawl hangs. We see the below errors in the application event logs:</p>
<p>Operation &#39;crawl hang&#39; is not responding and a recovery action will be attempted. <br />Search application &#39;-crawl-0&#39; appears to be malfunctioning and will be reinitialized.</p>
<p></p>
<p><span style="text-decoration:underline;"><strong>What we see in ULS logs: <br /></strong></span></p>
<p></p>
<p>--ULS is filled with these exceptions:</p>
<p><br /><br /><span style="font-size:9pt;">[DATE] 08:17:17.44 mssearch.exe (PID) TID SharePoint Server Search Crawler:Content Plugin af7zk High CTSSession::Init: m_CSSConnection.Service.CreateSession threw exception (System.ServiceModel.CommunicationException), message = Exception type is System.ServiceModel.FaultException`1[System.String] message = The creator of this fault did not specify a Reason.;, CSSNode = net.tcp://servername/ID/ContentProcessingComponent1/ContentSubmissionServices/content, Flow = Microsoft.CrawlerFlow </span></p>
<p><span style="font-size:9pt;">[DATE] 08:17:17.44 mssearch.exe (PID) TID SharePoint Server Search Crawler:Content Plugin ahg9y High CSSFeeder::Run: session is not recreated or lost connection - reconnecting </span></p>
<p></p>
<p></p>
<p>--After every such failure, the noderunner component attempts to provision a flow and fails: <br /><br /><span style="font-size:9pt;">[DATE] 08:17:17.52 NodeRunnerContent1-16d3caaa-174 (PID) TID Search Common Processing <span style="background-color:yellow;"><strong>ai9on</strong></span> Monitorable [Microsoft.CrawlerFlow-c5e47b65-99e6-4a78-8f64-3eec1cf9afd6] Microsoft.Ceres.Evaluation.Engine.Flows.FlowHandle : Failure during evaluation set-up Flow name: Microsoft.CrawlerFlow Flow identifier: 86fa4f70-16a6-4f12-b7ff-3f9e561e876e <span style="background-color:yellow;"><strong>System.InvalidOperationException: Sandbox worker pool is closed.</strong></span> <br />at Microsoft.Ceres.DocParsing.Runtime.Core.Sandbox.<span style="background-color:yellow;"><strong>SandboxWorkerPool.AcquireProxy</strong></span>(Guid sessionId, ParsingConfiguration configuration) <br />at Microsoft.Ceres.DocParsing.Runtime.Core.SessionManager.CreateSession(ParsingConfiguration configuration) <br />at Microsoft.Ceres.ContentEngine.Parsing.Evaluators.DocumentParserEvaluator.DocumentParserProducer.OpenParsingSession() <br />at Microsoft.Ceres.Evaluation.Processing.Producers.RecordProducerBase`1.SetInputProperties(RecordSetProperties inputProperties) <br />at Microsoft.Ceres.Evaluation.Processing.Producers.ProducerRecordSetSink.SetProperties(RecordSetProperties properties) <br />at Microsoft.Ceres.Evaluation.Processing.Producers.MultiOutputProducer`1.SetOutputProperties(Int32 index, RecordSetProperties properties) <br />at Microsoft.Ceres.Evaluation.Processing.Producers.MultiOutputProducer`1.SetOutputProperties(RecordSetProperties properties) <br />at Microsoft.Ceres.ContentEngine.Processing.BuiltIn.RouterProducer.Initialize() <br />at Microsoft.Ceres.Evaluation.Processing.Producers.RecordProducerBase`1.SetInputProperties(RecordSetProperties inputProperties) <br />at Microsoft.Ceres.Evaluation.Processing.Producers.ProducerRecordSetSink.SetProperties(RecordSetProperties properties) <br />at Microsoft.Ceres.Evaluation.Engine.PushPull.PushPullThread..ctor(EvaluationContext context, IRecordSetSink output, IRecordSet input) <br />at Microsoft.Ceres.Evaluation.Engine.PushPull.PullPushEvaluator.AddInput(Edge inputEdge, IRecordSet recordSet) <br />at Microsoft.Ceres.Evaluation.Engine.Flows.EvaluationContext.SetupOutputs(LinkedList`1 orderedOperators, IDictionary`2 edgeMap) <br />at Microsoft.Ceres.Evaluation.Engine.Flows.EvaluationContext.DoEvaluate(OperatorFlow flow, EvaluationConfig config, FlowHandle handle) <br />at Microsoft.Ceres.Evaluation.Engine.Flows.EvaluationContextFsm.Evaluate(EventArgs args) <br />at Microsoft.Ceres.Common.Utils.StateMachine.FsmActionTask.Execute(EventArgs args) <br />at Microsoft.Ceres.Common.Utils.StateMachine.FsmAction.Execute(EventArgs args) <br />at Microsoft.Ceres.Common.Utils.StateMachine.FiniteStateMachine`1.DoHandleEvent(FsmEvent fsmEvent, EventArgs args) <br />at Microsoft.Ceres.Common.Utils.StateMachine.FiniteStateMachine`1.InternalHandleEvent(FsmEvent fsmEvent, EventArgs args) <br />at Microsoft.Ceres.Evaluation.Engine.Flows.EvaluationContext.EvaluateGraph(OperatorFlow operatorGraph, FlowHandle handle, EvaluationConfig config) <br />at Microsoft.Ceres.Evaluation.Engine.EvaluationWorker.InternalEvaluateAndStart(OperatorFlow graph, FlowHandle handle, Guid id, EvaluationConfig config, IFlowDebugHandler debugHandler, BreakpointSpecification[] initialBreakpoints) <br /><br />[DATE] 08:17:17.52 NodeRunnerContent1-16d3caaa-174 (PID) TID Search Content Processing ai89u Monitorable ContentIntegrationEngine: Execution of flow Microsoft.CrawlerFlow with id 86fa4f70-16a6-4f12-b7ff-3f9e561e876e failed. </span></p>
<p><span style="font-size:9pt;">[DATE] 08:17:17.52 NodeRunnerContent1-16d3caaa-174 (PID) TID Search Common Processing 25 Warning FlowName=Microsoft.CrawlerFlow. FlowID=86fa4f70-16a6-4f12-b7ff-3f9e561e876e. Flow failed during processing. The original error was Failure during evaluation set-up (Exception type: System.InvalidOperationException. Exception message: Sandbox worker pool is closed.) </span></p>
<p><span style="font-size:9pt;">[DATE] 08:17:17.52 NodeRunnerContent1-16d3caaa-174 (PID) TID Search Content Processing ai9li Monitorable Microsoft.Ceres.ContentEngine.SubmitterComponent.SessionFlowHandler : Evaluation with parent identifier 1c14e435-cd68-4f29-bc10-b3cc3fbf4f97 is not running. The state of the single evaluation is Failed. </span></p>
<p><span style="font-size:9pt;">[DATE] 08:17:17.52 NodeRunnerContent1-16d3caaa-174 (PID) TID Search Content Processing ai9mb Monitorable Microsoft.Ceres.ContentEngine.SubmitterComponent.SubmissionService : Create Session failing: Microsoft.Ceres.ContentEngine.Services.SubmissionService.FailedToStartFlowException: Unable to start a flow instance on any of the available nodes. ---&gt; Microsoft.Ceres.ContentEngine.Services.SubmissionService.FailedToStartFlowException: Unable to start a flow instance on any of the available nodes. at Microsoft.Ceres.ContentEngine.SubmitterComponent.SessionWorker.Initialize() at Microsoft.Ceres.ContentEngine.SubmitterComponent.Session.Start() at Microsoft.Ceres.ContentEngine.SubmitterComponent.Session.Open() --- End of inner exception stack trace --- at Microsoft.Ceres.ContentEngine.SubmitterComponent.Session.Open() at Microsoft.Ceres.ContentEngine.SubmitterComponent.SubmissionService.CreateSession(FeedingSessionSettings settings) </span></p>
<p><span style="font-size:9pt;">[DATE] 08:17:17.52 NodeRunnerContent1-16d3caaa-174 (PID) TID Search Content Processing ai9j8 Monitorable Microsoft.Ceres.ContentEngine.SubmitterComponent.ContentSubmissionDecorator : CreateSession failed: System.ServiceModel.FaultException`1[System.String]: The creator of this fault did not specify a Reason. (Fault Detail is equal to Specified flow: Microsoft.CrawlerFlow could not be started. Unable to start a flow instance on any of the available nodes.). </span></p>
<p><span style="font-size:9pt;">[DATE] 08:17:17.52 NodeRunnerContent1-16d3caaa-174 (PID) TID Search Content Processing ai9kq Unexpected Microsoft.Ceres.ContentEngine.SubmitterComponent.ContentSubmissionDecorator : CreateSession() failed with unexpected exception System.ServiceModel.FaultException`1[System.String]: The creator of this fault did not specify a Reason. (Fault Detail is equal to Specified flow: Microsoft.CrawlerFlow could not be started. Unable to start a flow instance on any of the available nodes.). </span></p>
<p><span style="font-size:9pt;">[DATE] 08:17:17.52 NodeRunnerContent1-16d3caaa-174 (PID) TID Search Search Platform Services alm32 Medium Exception in remote service invocation (service=content, method=http://schemas.microsoft.com/ceres/contenttransformation/2009/11/submission/IContentSubmissionService/CreateSession, user=DOMAIN\FarmAccount): System.ServiceModel.FaultException`1[System.String]: The creator of this fault did not specify a Reason. (Fault Detail is equal to Specified flow: Microsoft.CrawlerFlow could not be started. Unable to start a flow instance on any of the available nodes.). </span></p>
<p></p>
<p><span style="background-color:#ffff00;"><strong>--So essentially, mssearch.exe is unable to feed the content to CPC, because we don&#39;t have any flows open/available.</strong></span></p>
<p>--We see these messages incrementally:</p>
<p><span style="font-size:9pt;">[DATE] 08:54:04.85 mssearch.exe (PID) TID SharePoint Server Search Crawler:Gatherer Service ad9s9 Medium CGthrPrj::PingPlugins no transaction committed in 3706 seconds [cgatherprj.cxx:2581] search\native\gather\gthrsvc\cgatherprj.cxx </span></p>
<p><span style="font-size:9pt;">[DATE] 08:54:14.93 mssearch.exe (PID) TID SharePoint Server Search Crawler:Gatherer Service ad9s9 Medium CGthrPrj::PingPlugins no transaction committed in 3716 seconds [cgatherprj.cxx:2581] search\native\gather\gthrsvc\cgatherprj.cxx </span></p>
<p><span style="font-size:9pt;">[DATE] 08:54:24.98 mssearch.exe (PID) TID SharePoint Server Search Crawler:Gatherer Service ad9s9 Medium CGthrPrj::PingPlugins no transaction committed in 3726 seconds [cgatherprj.cxx:2581] search\native\gather\gthrsvc\cgatherprj.cxx </span></p>
<p><span style="font-size:9pt;">[DATE] 09:04:16.59 mssearch.exe (PID) TID SharePoint Server Search Crawler:Gatherer Service ad9s9 Medium CGthrPrj::PingPlugins no transaction committed in 124 seconds [cgatherprj.cxx:2581] search\native\gather\gthrsvc\cgatherprj.cxx </span></p>
<p><span style="font-size:9pt;">[DATE] 09:04:26.65 mssearch.exe (PID) TID SharePoint Server Search Crawler:Gatherer Service ad9s9 Medium CGthrPrj::PingPlugins no transaction committed in 134 seconds [cgatherprj.cxx:2581] search\native\gather\gthrsvc\cgatherprj.cxx </span></p>
<p></p>
<p></p>
<p>--We see that every time the time elapsed hits around 3700 seconds, it resets.</p>
<p><span style="background-color:#ffff00;"><strong>--Below are the entries we see when search application re-initializes itself and this corresponds to the two events we see in the application event logs roughly every one hour</strong></span>:</p>
<p><span style="font-size:9pt;">[DATE] 08:54:30.22 mssearch.exe (PID) TID SharePoint Server Search Crawler:Gatherer Service ds3f High Processing new problem 2 for application GUID-crawl-0 (1, 1, 1) [gthrapp.cxx:5651] search\native\gather\gthrsvc\gthrapp.cxx <br />[DATE] 08:54:30.22 mssearch.exe (PID) TID SharePoint Server Search Crawler:Common aikdz Assert <br />location: search\native\gather\gthrsvc\gthrapp.cxx(6686) condition: !&quot;Dismounting application with hanged crawl&quot; StackTrace: <br />at Microsoft.Office.Server.Native.dll: (sig=c3cf111a-d6fc-4ec5-ba1c-c9b8ebb47e41|2|microsoft.office.server.native.pdb, offset=1F074) <br />at MSSrch.dll: (sig=bcc79b69-8dc0-4f7b-b42b-469030237946|2|mssrch.pdb, offset=22759) <br />at MSSrch.dll: (offset=226FD) <br />at MSSrch.dll: (offset=89F2C) <br />at MSSrch.dll: (offset=8FAC7) <br />at MSSrch.dll: (offset=8938F)<br />at MSSrch.dll: (offset=94802) <br />at MSSrch.dll: (offset=71855) <br />at kernel32.dll: (sig=c4312728-ba1f-4691-955e-99b2e026fafc|2|kernel32.pdb, offset=1652D) <br />at ntdll.dll: (sig=fb62ad7b-aec9-42f9-81e9-c6c84c71c11c|2|ntdll.pdb, offset=2C541 <br /><br />[DATE] 08:54:30.22 mssearch.exe (PID) TID SharePoint Server Search Search service events <span style="background-color:yellow;"><strong>eq62</strong></span> Warning <span style="background-color:yellow;"><strong>Search application &#39;GUID-crawl-0&#39; appears to be malfunctioning and will be reinitialized</strong></span>. </span></p>
<p><span style="font-size:9pt;">[DATE] 08:54:30.22 mssearch.exe (PID) TID SharePoint Server Search Crawler:Gatherer Plugin <span style="background-color:yellow;"><strong>e5aq</strong></span> High locking gatherer for <span style="background-color:yellow;"><strong>status change NSC_SHUTDOWN</strong></span> (GUID-crawl-0, Portal_Content, crawl -1) [gatherobj.cxx:1664] search\native\gather\server\gatherobj.cxx </span></p>
<p><span style="font-size:9pt;">[DATE] 08:54:30.22 mssearch.exe (PID) TID SharePoint Server Search Crawler:Gatherer Plugin e5fn Medium CGatherer::CancelCompleteTransactions is called [gatherobj.cxx:7910] search\native\gather\server\gatherobj.cxx </span></p>
<p><span style="font-size:9pt;">[DATE] 08:54:30.22 mssearch.exe (PID) TID SharePoint Server Search Crawler:Content Plugin <span style="background-color:yellow;"><strong>dts3</strong></span> Medium <strong><span style="background-color:yellow;">Received signal (PrepareStatusChange): NSC_SHUTDOWN</span> </strong>[contentpiobj.cxx:595] search\native\gather\plugins\contentpi\contentpiobj.cxx </span></p>
<p><span style="font-size:9pt;">[DATE] 08:54:30.22 mssearch.exe (PID) TID SharePoint Server Search Crawler:Content Plugin <span style="background-color:yellow;"><strong>af7y2</strong></span> High <span style="background-color:yellow;"><strong>CSSFeedersManager::Shutdown called</strong></span> </span></p>
<p><span style="font-size:9pt;">[DATE] 08:54:31.90 mssearch.exe (PID) TID SharePoint Server Search Crawler:Gatherer Plugin e5ga High CGatherer::FlushLinks FlushLinksForCrawl fails project ID 1, crawl ID 1 [gatherobj.cxx:9073] search\native\gather\server\gatherobj.cxx </span></p>
<p>&nbsp;</p>
<p></p>
<p></p>
<p>--The root cause appears to be</p>
<p><span style="font-size:9pt;">[DATE] 08:17:17.52 NodeRunnerContent1-16d3caaa-174 (PID) TID Search Common Processing <span style="background-color:yellow;"><strong>ai9on</strong></span> Monitorable <br />[Microsoft.CrawlerFlow-c5e47b65-99e6-4a78-8f64-3eec1cf9afd6] Microsoft.Ceres.Evaluation.Engine.Flows.FlowHandle : <span style="background-color:yellow;"><strong>Failure during evaluation set-up Flow name: Microsoft.CrawlerFlow Flow identifier: 86fa4f70-16a6-4f12-b7ff-3f9e561e876e System.InvalidOperationException: Sandbox worker pool is closed.</strong></span> <br />at Microsoft.Ceres.DocParsing.Runtime.Core.Sandbox.SandboxWorkerPool.AcquireProxy(Guid sessionId, ParsingConfiguration configuration) <br />at Microsoft.Ceres.DocParsing.Runtime.Core.SessionManager.CreateSession(ParsingConfiguration configuration) </span></p>
<p>&nbsp;</p>
<p><span style="text-decoration:underline;"><strong>How do we fix this? </strong></span></p>
<p><br />&bull; Based on prolonged research, this issue appeared to be permissions related. <br />&bull; Checked account search is running under -&gt; All the NodeRunner processes are running with:</p>
<p>DOMAIN\FarmAccount</p>
<p>&bull; This account is the farm account. The farm account is local admin on the server. <br />&bull; Checked these group policies:</p>
<p><span style="font-size:9pt;">SeAssignPrimaryTokenPrivilege (Replace a process-level token) -&gt; <strong>FARM ACCOUNT IS NOT HERE.</strong> <br />SeImpersonatePrivilege (Impersonate a client after authentication) -&gt; Farm account is present here. <br />SeServiceLogonRight (Log on as a service) -&gt; <strong>FARM ACCOUNT IS NOT HERE.</strong> <br />SeIncreaseQuotaPrivilege (Adjust memory quotas for a process) -&gt; <strong>FARM ACCOUNT IS NOT HERE.</strong> <br />Log on as a batch job -&gt; <strong>FARM ACCOUNT IS NOT HERE.</strong> </span></p>
<p>&bull; This account requires the below privileges primarily for the crawls to prevent those errors:</p>
<p><span style="font-size:9pt;">SeAssignPrimaryTokenPrivilege (Replace a process-level token) <br />SeImpersonatePrivilege (Impersonate a client after authentication) <br />SeServiceLogonRight (Log on as a service) <br />SeIncreaseQuotaPrivilege (Adjust memory quotas for a process)<br /></span><br />&bull; If NodeRunner is not running with the farm account, we need to ensure the specific account it uses has the above set of permissions.</p>]]></content:encoded>
    </item>
    <item>
      <title>Code Sample – Enumerate all sub webs of a SPO site collection</title>
      <link>https://docs.microsoft.com/archive/blogs/sharepointrecipes/code-sample-enumerate-all-sub-webs-of-a-spo-site-collection</link>
      <pubDate>Wed, 17 Jun 2015 19:45:57 GMT</pubDate>
      <dc:creator><![CDATA[nirmas]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/sharepointrecipes/2015/06/17/code-sample-enumerate-all-sub-webs-of-a-spo-site-collection/</guid>
      <description><![CDATA[In SharePoint OnPremise, it is very easy to enumerate all the sub webs [SPWeb] of a site collection...]]></description>
      <content:encoded><![CDATA[<p>In SharePoint OnPremise, it is very easy to enumerate all the sub webs [SPWeb] of a site collection [SPSite]. This is exposed as the AllWebs property under the SPSite object – See <a href="https://msdn.microsoft.com/EN-US/library/office/microsoft.sharepoint.spsite.allwebs.aspx">here</a>.
</p><p>However, this is not exposed in SharePoint Online via CSOM. So in order to touch all the SPWeb objects via CSOM, we need to use recursion – and the below code sample can assist in achieving that.
</p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:darkgreen;"># replace these details (also consider using Get-Credential to enter password securely as script runs) </span>
		</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:orangered;">$username</span>
			<span style="color:darkgray;">=</span>
			<span style="color:darkred;">&quot;administrator@domain.onmicrosoft.com&quot;</span>
		</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:orangered;">$password</span>
			<span style="color:darkgray;">=</span>
			<span style="color:darkred;">&quot;pwd&quot;</span>
		</span></p><p style="background:white;">
 </p><p style="background:white;"><span style="color:darkgreen;font-family:Lucida Console;font-size:9pt;">#Provide site collection URL here. Alternatively, you can enumerate all site collections using get-sposite and process each.
</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:darkgreen;">#The SPSite will be constructed based on this URL. </span>
		</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:orangered;">$url</span>
			<span style="color:darkgray;">=</span>
			<span style="color:darkred;">&quot;https://domain.sharepoint.com/&quot;</span>
		</span></p><p style="background:white;"> 
 </p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:orangered;">$securePassword</span>
			<span style="color:darkgray;">=</span>
			<span style="color:blue;">ConvertTo-SecureString</span>
			<span style="color:orangered;">$Password</span>
			<span style="color:navy;">-AsPlainText</span>
			<span style="color:navy;">-Force</span>
		</span></p><p style="background:white;"> 
 </p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:darkgreen;">#Install SharePoint Online Client SDK on the machine you are running this script to load these DLLs.</span>
		</span></p><p style="background:white;">
 </p><p style="background:white;"><span style="color:darkgray;font-family:Lucida Console;font-size:9pt;">[<span style="color:teal;">System.Reflection.Assembly<span style="color:darkgray;">]::</span>LoadWithPartialName(<span style="color:darkred;">&#39;Microsoft.SharePoint.Client&#39;</span>)
</span></span></p><p style="background:white;"><span style="color:darkgray;font-family:Lucida Console;font-size:9pt;">[<span style="color:teal;">System.Reflection.Assembly<span style="color:darkgray;">]::</span>LoadWithPartialName(<span style="color:darkred;">&#39;Microsoft.SharePoint.Client.Runtime&#39;</span>)
</span></span></p><p style="background:white;">
 </p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:darkgreen;"># connect/authenticate to SharePoint Online and get ClientContext object </span>
		</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:orangered;">$clientContext</span>
			<span style="color:darkgray;">=</span>
			<span style="color:blue;">New-Object</span>
			<span style="color:blueviolet;">Microsoft.SharePoint.Client.ClientContext</span>(<span style="color:orangered;">$url</span>) 
</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:orangered;">$credentials</span>
			<span style="color:darkgray;">=</span>
			<span style="color:blue;">New-Object</span>
			<span style="color:blueviolet;">Microsoft.SharePoint.Client.SharePointOnlineCredentials</span>(<span style="color:orangered;">$username<span style="color:darkgray;">,</span> $securePassword</span>) 
</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:orangered;">$clientContext<span style="color:darkgray;">.</span>Credentials <span style="color:darkgray;">=</span> $credentials</span>
		</span></p><p style="background:white;"> 
 </p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:darkblue;">if</span> (<span style="color:darkgray;">!<span style="color:orangered;">$clientContext<span style="color:darkgray;">.</span>ServerObjectIsNull<span style="color:darkgray;">.</span>Value) 
</span></span></span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">{ 
</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">
			<span style="color:blue;">Write-Host</span>
			<span style="color:darkred;">&quot;Connected to SharePoint Online site: &#39;<span style="color:orangered;">$Url<span style="color:darkred;">&#39;&quot;</span>
					<span style="color:navy;">-ForegroundColor</span>
					<span style="color:blueviolet;">Green</span>
				</span></span></span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">} 
</span></p><p style="background:white;">
 </p><p style="background:white;">
 </p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:darkblue;">function</span>
			<span style="color:blueviolet;">processWeb</span>(<span style="color:orangered;">$web</span>)
</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">{
</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">    <span style="color:darkblue;">if</span>(<span style="color:orangered;">$urls</span>
			<span style="color:darkgray;">-notcontains</span>
			<span style="color:orangered;">$web<span style="color:darkgray;">.</span>url)
</span></span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">    {
</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">        <span style="color:orangered;">$urls</span>
			<span style="color:darkgray;">+=</span>
			<span style="color:orangered;">$web<span style="color:darkgray;">.</span>url
</span></span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">    }
</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">    <span style="color:darkblue;">function</span>
			<span style="color:blueviolet;">getchildcount</span>(<span style="color:orangered;">$web</span>)
</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">    {
</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">        <span style="color:orangered;">$web<span style="color:darkgray;">.</span>Context<span style="color:darkgray;">.</span>Load($web<span style="color:darkgray;">.</span>webs)
</span></span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">
			<span style="color:orangered;">$web<span style="color:darkgray;">.</span>Context<span style="color:darkgray;">.</span>ExecuteQuery()
</span></span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">
			<span style="color:darkblue;">return</span>
			<span style="color:orangered;">$web<span style="color:darkgray;">.</span>Webs<span style="color:darkgray;">.</span>Count
</span></span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">    }
</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">    <span style="color:darkblue;">if</span>((<span style="color:blue;">getchildcount</span>(<span style="color:orangered;">$web</span>)) <span style="color:darkgray;">-gt</span>
			<span style="color:purple;">0</span>)
</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">    {
</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">        <span style="color:orangered;">$ch</span>
			<span style="color:darkgray;">=</span>
			<span style="color:orangered;">$web<span style="color:darkgray;">.</span>Webs
</span></span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">        <span style="color:darkblue;">foreach</span>(<span style="color:orangered;">$c</span>
			<span style="color:darkblue;">in</span>
			<span style="color:orangered;">$ch</span>)
</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">        {
</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">            <span style="color:orangered;">$WEB<span style="color:darkgray;">.</span>Context<span style="color:darkgray;">.</span>Load($C</span>)
</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">
			<span style="color:orangered;">$web<span style="color:darkgray;">.</span>Context<span style="color:darkgray;">.</span>ExecuteQuery()
</span></span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">
			<span style="color:blue;">processWeb</span>(<span style="color:orangered;">$c</span>)
</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">        }
</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">    }
</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">    <span style="color:darkblue;">return</span>
			<span style="color:orangered;">$urls</span>
		</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">}
</span></p><p style="background:white;"> 
 </p><p style="background:white;">
 </p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:orangered;">$rootweb</span>
			<span style="color:darkgray;">=</span>
			<span style="color:orangered;">$clientContext<span style="color:darkgray;">.</span>Web
</span></span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:orangered;">$clientContext<span style="color:darkgray;">.</span>Load($rootweb</span>)
</span></p><p style="background:white;"><span style="color:orangered;font-family:Lucida Console;font-size:9pt;">$clientContext<span style="color:darkgray;">.</span>ExecuteQuery()
</span></p><p style="background:white;">
 </p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:darkgreen;">#This command may take some time to complete – can be monitored using a tracing tool like Fiddler.</span>
		</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:orangered;">$subwebURLs</span>
			<span style="color:darkgray;">=</span>
			<span style="color:blue;">processWeb</span>(<span style="color:orangered;">$rootweb</span>)
</span></p><p style="background:white;">
 </p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:darkgreen;">#Displaying the list of SPWeb URLs as a result.</span>
		</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:orangered;">$subwebURLs</span>
		</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">
		</span> </p>]]></content:encoded>
    </item>
    <item>
      <title>Code Sample – Parse eml file as SPEmailMessage</title>
      <link>https://docs.microsoft.com/archive/blogs/sharepointrecipes/code-sample-parse-eml-file-as-spemailmessage</link>
      <pubDate>Wed, 17 Jun 2015 07:49:07 GMT</pubDate>
      <dc:creator><![CDATA[nirmas]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/sharepointrecipes/2015/06/17/code-sample-parse-eml-file-as-spemailmessage/</guid>
      <description><![CDATA[A while back, we happened to work on an issue with SharePoint Incoming email. We saw that certain...]]></description>
      <content:encoded><![CDATA[<p>
 </p><p>A while back, we happened to work on an issue with SharePoint Incoming email. We saw that certain types of attachments were causing issues with this set up. In order to check what SharePoint was doing with the eml files in the Drop folder, we first needed to parse them like SharePoint would. Below sample code shows how this is done:
</p><p>Reference - <a href="https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.utilities.spemailmessage.aspx">SPEmailMessage class</a>
	</p><p><span style="color:#979797;font-family:Lucida Console;font-size:9pt;"><span style="background-color:white;">[<span style="color:teal;">system.reflection.assembly<span style="color:#979797;">]::<span style="color:black;">LoadWithPartialName(<span style="color:darkred;">&#39;Microsoft.sharepoint&#39;<span style="color:black;">)</span></span></span></span></span></span>
		</span></p><p><span style="color:orangered;font-size:9pt;"><span style="font-family:Lucida Console;background-color:white;">$fileInfo</span><span style="color:black;"><span style="font-family:Segoe UI;background-color:white;"> </span><span style="color:#979797;"><span style="font-family:Lucida Console;background-color:white;">=</span><span style="color:black;"><span style="font-family:Segoe UI;background-color:white;"> </span><span style="color:blue;"><span style="font-family:Lucida Console;background-color:white;">new-object</span><span style="color:black;"><span style="font-family:Segoe UI;background-color:white;"> </span><span style="color:blueviolet;"><span style="font-family:Lucida Console;background-color:white;">System.IO.FileInfo<span style="color:black;">(<span style="color:darkred;">&#39;C:\inetpub\mailroot\DROP\&lt;random_number&gt;.eml&#39;<span style="color:black;">)</span></span></span></span>
								</span></span></span></span></span></span></span></p><p><span style="color:orangered;font-size:9pt;"><span style="font-family:Lucida Console;background-color:white;">$fs</span><span style="color:black;"><span style="font-family:Segoe UI;background-color:white;"> </span><span style="color:#979797;"><span style="font-family:Lucida Console;background-color:white;">=</span><span style="color:black;"><span style="font-family:Segoe UI;background-color:white;"> </span><span style="color:orangered;"><span style="font-family:Lucida Console;background-color:white;">$fileInfo<span style="color:#979797;">.<span style="color:black;">OpenRead()</span></span></span>
						</span></span></span></span></span></p><p><span style="color:orangered;font-size:9pt;"><span style="font-family:Lucida Console;background-color:white;">$fs<span style="color:#979797;">.<span style="color:black;">Seek(<span style="color:purple;">0<span style="color:#979797;">,</span></span></span></span></span><span style="color:black;"><span style="font-family:Segoe UI;background-color:white;"> </span><span style="color:#979797;"><span style="font-family:Lucida Console;background-color:white;">[<span style="color:teal;">System.IO.SeekOrigin<span style="color:#979797;">]::<span style="color:black;">Begin)</span></span></span></span>
				</span></span></span></p><p><span style="color:orangered;font-size:9pt;"><span style="font-family:Lucida Console;background-color:white;">$message</span><span style="color:black;"><span style="font-family:Segoe UI;background-color:white;"> </span><span style="color:#979797;"><span style="font-family:Lucida Console;background-color:white;">=</span><span style="color:black;"><span style="font-family:Segoe UI;background-color:white;"> </span><span style="color:blue;"><span style="font-family:Lucida Console;background-color:white;">new-object</span><span style="color:black;"><span style="font-family:Segoe UI;background-color:white;"> </span><span style="color:blueviolet;"><span style="font-family:Lucida Console;background-color:white;">Microsoft.SharePoint.Utilities.SPEmailMessage</span><span style="color:black;"><span style="font-family:Segoe UI;background-color:white;">( </span><span style="color:orangered;"><span style="font-family:Lucida Console;background-color:white;">$fs<span style="color:#979797;">,</span></span><span style="color:black;"><span style="font-family:Segoe UI;background-color:white;"> </span><span style="color:darkred;"><span style="font-family:Lucida Console;background-color:white;">&quot;<span style="color:black;">account@domain.com<span style="color:darkred;">&quot;<span style="color:black;">)</span></span></span></span>
												</span></span></span></span></span></span></span></span></span></span></span></p><p><span style="color:orangered;font-size:9pt;"><span style="font-family:Lucida Console;background-color:white;">$message<span style="color:#979797;">.</span></span><span style="color:black;"><span style="font-family:Segoe UI;background-color:white;">Attachments | fl </span>
			</span></span></p><p>
 </p><p>Using the above parsing technique, we can enumerate and inspect all the attachments as .Net objects, and see if anything stands out for the prospective bad attachments. </p>]]></content:encoded>
    </item>
    <item>
      <title>Code Sample – Enumerating ODB sites in SharePoint Online tenant</title>
      <link>https://docs.microsoft.com/archive/blogs/sharepointrecipes/code-sample-enumerating-odb-sites-in-sharepoint-online-tenant</link>
      <pubDate>Wed, 17 Jun 2015 07:16:44 GMT</pubDate>
      <dc:creator><![CDATA[nirmas]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/sharepointrecipes/2015/06/17/code-sample-enumerating-odb-sites-in-sharepoint-online-tenant/</guid>
      <description><![CDATA[There was a requirement a while back to enumerate all the MySites [aka ODB Sites/OneDrive for...]]></description>
      <content:encoded><![CDATA[<p>There was a requirement a while back to enumerate all the MySites [aka ODB Sites/OneDrive for Business sites/Personal Sites] present on a SharePoint Online tenant. Since there was no way to see this in the UI on the admin centre, we need to use a script to grab this information. The detection logic involved enumerating all the user profiles on the tenant, and then grabbing the personal space property [if present]. This will give us the MySites on the tenant. We are using web service calls here to accomplish this - UserProfileService.asmx
</p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:darkgreen;">#install SharePoint Online Client SDK on the machine you are running this from.</span>
		</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:darkgreen;">#run this script as local box admin</span>
		</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:darkgreen;"># Keep tenant admin account details handy</span>
		</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:darkgreen;"># ensure there is a folder called c:\op on the box that is running this script.</span>
		</span></p><p style="background:white;">
 </p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:darkgreen;">#grab tenant information</span>
		</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:orangered;">$domain</span>
			<span style="color:darkgray;">=</span>
			<span style="color:blue;">Read-Host</span>
			<span style="color:darkred;">&quot;Enter the domain prefix&quot;</span>
		</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:orangered;">$adminURI</span>
			<span style="color:darkgray;">=</span>
			<span style="color:darkred;">&#39;https://&#39;</span>
			<span style="color:darkgray;">+</span>
			<span style="color:orangered;">$domain</span>
			<span style="color:darkgray;">+</span>
			<span style="color:darkred;">&#39;-admin.sharepoint.com&#39;</span>
		</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:orangered;">$admin_account</span>
			<span style="color:darkgray;">=</span>
			<span style="color:blue;">Read-Host</span>
			<span style="color:darkred;">&quot;Enter the tenant admin account login&quot;</span>
		</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:orangered;">$pwd</span>
			<span style="color:darkgray;">=</span>
			<span style="color:blue;">read-host</span>
			<span style="color:navy;">-AsSecureString</span>
			<span style="color:darkred;">&quot;Enter the admin account password&quot;</span>
		</span></p><p style="background:white;">
 </p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:darkgreen;">#load the assemblies</span>
		</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:orangered;">$loadInfo1</span>
			<span style="color:darkgray;">=</span>
			<span style="color:darkgray;">[<span style="color:teal;">System.Reflection.Assembly<span style="color:darkgray;">]::</span>LoadWithPartialName(<span style="color:darkred;">&quot;Microsoft.SharePoint.Client&quot;</span>)
</span></span></span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:orangered;">$loadInfo2</span>
			<span style="color:darkgray;">=</span>
			<span style="color:darkgray;">[<span style="color:teal;">System.Reflection.Assembly<span style="color:darkgray;">]::</span>LoadWithPartialName(<span style="color:darkred;">&quot;Microsoft.SharePoint.Client.Runtime&quot;</span>)
</span></span></span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:orangered;">$loadInfo3</span>
			<span style="color:darkgray;">=</span>
			<span style="color:darkgray;">[<span style="color:teal;">System.Reflection.Assembly<span style="color:darkgray;">]::</span>LoadWithPartialName(<span style="color:darkred;">&quot;Microsoft.SharePoint.Client.UserProfiles&quot;</span>)
</span></span></span></p><p style="background:white;">
 </p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:darkgreen;">#SPO Credentials</span>
		</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:orangered;">$creds</span>
			<span style="color:darkgray;">=</span>
			<span style="color:blue;">New-Object</span>
			<span style="color:blueviolet;">Microsoft.SharePoint.Client.SharePointOnlineCredentials</span>(<span style="color:orangered;">$Admin_Account<span style="color:darkgray;">,</span> $pwd</span>)
</span></p><p style="background:white;">
 </p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:darkgreen;"># Add the path of the User Profile Service to the SPO admin URL, then create a new webservice proxy to access it</span>
		</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:orangered;">$proxyaddr</span>
			<span style="color:darkgray;">=</span>
			<span style="color:darkred;">&quot;<span style="color:orangered;">$AdminURI<span style="color:darkred;">/_vti_bin/UserProfileService.asmx?wsdl&quot;</span>
				</span></span></span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:orangered;">$UserProfileService<span style="color:darkgray;">=</span>
				<span style="color:blue;">New-WebServiceProxy</span>
				<span style="color:navy;">-Uri</span> $proxyaddr</span>
			<span style="color:navy;">-UseDefaultCredential</span>
			<span style="color:blueviolet;">False</span>
		</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:orangered;">$UserProfileService<span style="color:darkgray;">.</span>Credentials <span style="color:darkgray;">=</span> $creds</span>
		</span></p><p style="background:white;"> 
 </p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:darkgreen;"># Take care of auth cookies</span>
		</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:orangered;">$strAuthCookie</span>
			<span style="color:darkgray;">=</span>
			<span style="color:orangered;">$creds<span style="color:darkgray;">.</span>GetAuthenticationCookie($AdminURI</span>)
</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:orangered;">$uri</span>
			<span style="color:darkgray;">=</span>
			<span style="color:blue;">New-Object</span>
			<span style="color:blueviolet;">System.Uri</span>(<span style="color:orangered;">$AdminURI</span>)
</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:orangered;">$container</span>
			<span style="color:darkgray;">=</span>
			<span style="color:blue;">New-Object</span>
			<span style="color:blueviolet;">System.Net.CookieContainer</span>
		</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:orangered;">$container<span style="color:darkgray;">.</span>SetCookies($uri<span style="color:darkgray;">,</span> $strAuthCookie</span>)
</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:orangered;">$UserProfileService<span style="color:darkgray;">.</span>CookieContainer <span style="color:darkgray;">=</span> $container</span>
		</span></p><p style="background:white;">  
 </p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:darkgreen;"># Grab the first User profile, at index -1</span>
		</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:orangered;">$odbsites</span>
			<span style="color:darkgray;">=</span> @()
</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:orangered;">$UserProfileResult</span>
			<span style="color:darkgray;">=</span>
			<span style="color:orangered;">$UserProfileService<span style="color:darkgray;">.</span>GetUserPr</span>ofileByIndex(<span style="color:purple;">-1</span>)
</span></p><p style="background:white;">  
 </p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:blue;">Write-Host</span>
			<span style="color:darkred;">&quot;Enumeration of PersonalSites on the tenant&quot;</span>
		</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:blue;">Write-Host</span>
			<span style="color:darkred;">&quot;Starting- This could take a while.&quot;</span>
		</span></p><p style="background:white;">  
 </p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:orangered;">$NumProfiles</span>
			<span style="color:darkgray;">=</span>
			<span style="color:orangered;">$UserProfileService<span style="color:darkgray;">.</span>GetUserProfileCount()
</span></span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:orangered;">$i</span>
			<span style="color:darkgray;">=</span>
			<span style="color:purple;">1</span>
		</span></p><p style="background:white;">  
 </p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:darkgreen;"># As long as the next User profile is NOT the one we started with (at -1)...</span>
		</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:darkblue;">While</span> (<span style="color:orangered;">$UserProfileResult<span style="color:darkgray;">.</span>NextValue <span style="color:darkgray;">-ne</span>
				<span style="color:purple;">-1</span>) 
</span></span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">{
</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">
			<span style="color:blue;">Write-Host</span>
			<span style="color:darkred;">&quot;Examining profile <span style="color:orangered;">$i<span style="color:darkred;"> of <span style="color:orangered;">$NumProfiles<span style="color:darkred;">&quot;</span>
						</span></span></span></span></span></p><p style="background:white;">  
 </p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">
			<span style="color:darkgreen;"># Look for the Personal Space object in the User Profile and pull it out</span>
		</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">
			<span style="color:darkgreen;"># (PersonalSpace is the name of the path to a user&#39;s mysite)</span>
		</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">
			<span style="color:orangered;">$Prop</span>
			<span style="color:darkgray;">=</span>
			<span style="color:orangered;">$UserProfileResult<span style="color:darkgray;">.</span>UserProfile <span style="color:darkgray;">|</span>
				<span style="color:blue;">Where-Object</span> { $_<span style="color:darkgray;">.</span>Name <span style="color:darkgray;">-eq</span>
				<span style="color:darkred;">&quot;PersonalSpace&quot;</span> } 
</span></span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">
			<span style="color:orangered;">$Url<span style="color:darkgray;">=</span> $Prop<span style="color:darkgray;">.</span>Values<span style="color:darkgray;">[<span style="color:purple;">0<span style="color:darkgray;">].</span>Value
</span></span></span></span></p><p style="background:white;">  
 </p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">
			<span style="color:darkgreen;"># If &quot;PersonalSpace&quot; (which we&#39;ve copied to $Url) exists, log it to our array...</span>
		</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">
			<span style="color:darkblue;">if</span> (<span style="color:orangered;">$Url</span>) 
</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">    {
</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">
			<span style="color:darkgreen;">#$Url | Out-File $LogFile -Append -Force</span>
		</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">
			<span style="color:orangered;">$odbsites<span style="color:darkgray;">+=</span>(<span style="color:darkred;">&#39;https://&#39;<span style="color:darkgray;">+<span style="color:orangered;">$domain<span style="color:darkgray;">+<span style="color:darkred;">&#39;-my.sharepoint.com&#39;<span style="color:darkgray;">+<span style="color:orangered;">$url</span>)
</span></span></span></span></span></span></span></span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">    }
</span></p><p style="background:white;">  
 </p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">
			<span style="color:darkgreen;"># And now we check the next profile the same way...</span>
		</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">
			<span style="color:orangered;">$UserProfileResult</span>
			<span style="color:darkgray;">=</span>
			<span style="color:orangered;">$UserProfileService<span style="color:darkgray;">.</span>GetUserProfileByIndex($UserProfileResult<span style="color:darkgray;">.</span>NextValue)
</span></span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">
			<span style="color:orangered;">$i<span style="color:darkgray;">++</span>
			</span></span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">}
</span></p><p style="background:white;">
 </p><p style="background:white;">
 </p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:darkgreen;">#Dump out the ODB Sites URL to the file system</span>
		</span></p><p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:orangered;">$odbsites</span>
			<span style="color:darkgray;">|</span>
			<span style="color:blue;">out-file</span>
			<span style="color:blueviolet;">c:\op\odbsites.txt 
</span></span></p>]]></content:encoded>
    </item>
    <item>
      <title>Code Sample - SharePoint Online – Shared With Me</title>
      <link>https://docs.microsoft.com/archive/blogs/sharepointrecipes/code-sample-sharepoint-online-shared-with-me</link>
      <pubDate>Wed, 17 Jun 2015 06:35:00 GMT</pubDate>
      <dc:creator><![CDATA[nirmas]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/sharepointrecipes/2015/06/17/code-sample-sharepoint-online-shared-with-me/</guid>
      <description><![CDATA[#Below Script Sample emulates the Search Query that is sent out while browsing to Shared With Me...]]></description>
      <content:encoded><![CDATA[<p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:darkgreen;">#Below Script Sample emulates the Search Query that is sent out while browsing to Shared With Me page.</span> </span></p>
<p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:darkgreen;">#The oob page will have a row limit of 30 that is hard coded - but in this script, we can alter it. </span> </span></p>
<p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:darkgreen;">#The sample gives you Raw search results. Further development will be required to utilize these search results in a useful manner.</span> </span></p>
<p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:darkgreen;">#Note - the results are heavily dependent on Search Freshness.</span> </span></p>
<p style="background:white;">&nbsp;</p>
<p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:darkgreen;"># replace these details (also consider using Get-Credential to enter password securely as script runs) </span> </span></p>
<p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:orangered;">$username</span> <span style="color:darkgray;">=</span> <span style="color:darkred;">&quot;administrator@domain.com&quot;</span> </span></p>
<p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:orangered;">$password</span> <span style="color:darkgray;">=</span> <span style="color:darkred;">&quot;pwd&quot;</span> </span></p>
<p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:orangered;">$url</span> <span style="color:darkgray;">=</span> <span style="color:darkred;">&quot;https://domain-my.sharepoint.com&quot;</span> </span></p>
<p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:orangered;">$securePassword</span> <span style="color:darkgray;">=</span> <span style="color:blue;">ConvertTo-SecureString</span> <span style="color:orangered;">$Password</span> <span style="color:navy;">-AsPlainText</span> <span style="color:navy;">-Force</span> </span></p>
<p style="background:white;">&nbsp;</p>
<p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:darkgreen;">#Install SharePoint Online Client SDK</span> </span></p>
<p style="background:white;"><span style="color:darkgray;font-family:Lucida Console;font-size:9pt;">[<span style="color:teal;">system.reflection.assembly<span style="color:darkgray;">]::</span>LoadWithPartialName(<span style="color:darkred;">&#39;Microsoft.SharePoint.Client&#39;</span>) </span></span></p>
<p style="background:white;"><span style="color:darkgray;font-family:Lucida Console;font-size:9pt;">[<span style="color:teal;">system.reflection.assembly<span style="color:darkgray;">]::</span>LoadWithPartialName(<span style="color:darkred;">&#39;Microsoft.SharePoint.Client.Search&#39;</span>) </span></span></p>
<p style="background:white;"><span style="color:darkgray;font-family:Lucida Console;font-size:9pt;">[<span style="color:teal;">system.reflection.assembly<span style="color:darkgray;">]::</span>LoadWithPartialName(<span style="color:darkred;">&#39;Microsoft.SharePoint.Client.Runtime&#39;</span>) </span></span></p>
<p style="background:white;">&nbsp;</p>
<p style="background:white;">&nbsp;</p>
<p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:darkgreen;"># connect/authenticate to SharePoint Online and get ClientContext object.. </span> </span></p>
<p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:orangered;">$clientContext</span> <span style="color:darkgray;">=</span> <span style="color:blue;">New-Object</span> <span style="color:blueviolet;">Microsoft.SharePoint.Client.ClientContext</span>(<span style="color:orangered;">$url</span>) </span></p>
<p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:orangered;">$credentials</span> <span style="color:darkgray;">=</span> <span style="color:blue;">New-Object</span> <span style="color:blueviolet;">Microsoft.SharePoint.Client.SharePointOnlineCredentials</span>(<span style="color:orangered;">$username<span style="color:darkgray;">,</span> $securePassword</span>) </span></p>
<p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:orangered;">$clientContext<span style="color:darkgray;">.</span>Credentials <span style="color:darkgray;">=</span> $credentials</span> </span></p>
<p style="background:white;">&nbsp;</p>
<p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:darkblue;">if</span> (<span style="color:darkgray;">!<span style="color:orangered;">$clientContext<span style="color:darkgray;">.</span>ServerObjectIsNull<span style="color:darkgray;">.</span>Value) </span></span></span></p>
<p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">{ </span></p>
<p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"> <span style="color:blue;">Write-Host</span> <span style="color:darkred;">&quot;Connected to SharePoint Online site: &#39;<span style="color:orangered;">$Url<span style="color:darkred;">&#39;&quot;</span> <span style="color:navy;">-ForegroundColor</span> <span style="color:blueviolet;">Green</span> </span></span></span></p>
<p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;">} </span></p>
<p style="background:white;">&nbsp;</p>
<p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:orangered;">$web</span> <span style="color:darkgray;">=</span> <span style="color:orangered;">$clientContext<span style="color:darkgray;">.</span>Web </span></span></p>
<p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:orangered;">$clientContext<span style="color:darkgray;">.</span>Load($web</span>) </span></p>
<p style="background:white;"><span style="color:orangered;font-family:Lucida Console;font-size:9pt;">$clientContext<span style="color:darkgray;">.</span>ExecuteQuery() </span></p>
<p style="background:white;">&nbsp;</p>
<p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:darkgreen;">#enter the UPN of the user for whom you need to get SharedWithMe details. </span> </span></p>
<p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:orangered;">$username</span> <span style="color:darkgray;">=</span> &#39;<span style="color:darkred;">testuser@domain.onmicrosoft.com&#39;</span> </span></p>
<p style="background:white;">&nbsp;</p>
<p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:darkgreen;">#set RowLimit below to the number of results you want to see.</span> </span></p>
<p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:orangered;">$keywordQuery</span> <span style="color:darkgray;">=</span> <span style="color:blue;">New-Object</span> <span style="color:blueviolet;">Microsoft.SharePoint.Client.Search.Query.KeywordQuery</span>(<span style="color:orangered;">$clientContext</span>) </span></p>
<p style="background:white;"><span style="color:orangered;font-family:Lucida Console;font-size:9pt;">$keywordQuery<span style="color:darkgray;">.</span>QueryText <span style="color:darkgray;">=</span> <span style="color:darkred;">&#39;SharedWithUsersOWSUSER:\&#39;</span> <span style="color:darkgray;">+</span> $userName<span style="color:darkgray;">.</span>ToString() <span style="color:darkgray;">+</span> <span style="color:darkred;">&#39;\&#39;</span> </span></p>
<p style="background:white;"><span style="color:orangered;font-family:Lucida Console;font-size:9pt;">$keywordQuery<span style="color:darkgray;">.</span>ClientType <span style="color:darkgray;">=</span> <span style="color:darkred;">&quot;DocsSharedWithMe&quot;</span> </span></p>
<p style="background:white;"><span style="color:orangered;font-family:Lucida Console;font-size:9pt;">$keywordQuery<span style="color:darkgray;">.</span>StartRow <span style="color:darkgray;">=</span> <span style="color:purple;">0</span> </span></p>
<p style="background:white;"><span style="color:orangered;font-family:Lucida Console;font-size:9pt;">$keywordQuery<span style="color:darkgray;">.</span>RowLimit <span style="color:darkgray;">=</span> <span style="color:purple;">100</span> </span></p>
<p style="background:white;">&nbsp;</p>
<p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:orangered;">$keywordQuery<span style="color:darkgray;">.</span>ProcessBestBets <span style="color:darkgray;">=</span> $false</span> </span></p>
<p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:orangered;">$keywordQuery<span style="color:darkgray;">.</span>BypassResultTypes <span style="color:darkgray;">=</span> $true</span> </span></p>
<p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:orangered;">$keywordQuery<span style="color:darkgray;">.</span>EnableInterleaving <span style="color:darkgray;">=</span> $false</span> </span></p>
<p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:orangered;">$keywordQuery<span style="color:darkgray;">.</span>EnableQueryRules <span style="color:darkgray;">=</span> $false</span> </span></p>
<p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:orangered;">$keywordQuery<span style="color:darkgray;">.</span>EnableStemming <span style="color:darkgray;">=</span> $true</span> </span></p>
<p style="background:white;">&nbsp;</p>
<p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:darkgreen;">#modify below property set as per requirement - pull down only the ones that are required and will be used down the pipeline in your code.</span> </span></p>
<p style="background:white;"><span style="color:orangered;font-family:Lucida Console;font-size:9pt;">$keywordQuery<span style="color:darkgray;">.</span>SelectProperties<span style="color:darkgray;">.</span>Add(<span style="color:darkred;">&quot;Author&quot;</span>); </span></p>
<p style="background:white;"><span style="color:orangered;font-family:Lucida Console;font-size:9pt;">$keywordQuery<span style="color:darkgray;">.</span>SelectProperties<span style="color:darkgray;">.</span>Add(<span style="color:darkred;">&quot;ContentTypeId&quot;</span>); </span></p>
<p style="background:white;"><span style="color:orangered;font-family:Lucida Console;font-size:9pt;">$keywordQuery<span style="color:darkgray;">.</span>SelectProperties<span style="color:darkgray;">.</span>Add(<span style="color:darkred;">&quot;FileExtension&quot;</span>); </span></p>
<p style="background:white;"><span style="color:orangered;font-family:Lucida Console;font-size:9pt;">$keywordQuery<span style="color:darkgray;">.</span>SelectProperties<span style="color:darkgray;">.</span>Add(<span style="color:darkred;">&quot;Filename&quot;</span>); </span></p>
<p style="background:white;"><span style="color:orangered;font-family:Lucida Console;font-size:9pt;">$keywordQuery<span style="color:darkgray;">.</span>SelectProperties<span style="color:darkgray;">.</span>Add(<span style="color:darkred;">&quot;IsMyDocuments&quot;</span>); </span></p>
<p style="background:white;"><span style="color:orangered;font-family:Lucida Console;font-size:9pt;">$keywordQuery<span style="color:darkgray;">.</span>SelectProperties<span style="color:darkgray;">.</span>Add(<span style="color:darkred;">&quot;LastModifiedTime&quot;</span>); </span></p>
<p style="background:white;"><span style="color:orangered;font-family:Lucida Console;font-size:9pt;">$keywordQuery<span style="color:darkgray;">.</span>SelectProperties<span style="color:darkgray;">.</span>Add(<span style="color:darkred;">&quot;ListID&quot;</span>); </span></p>
<p style="background:white;"><span style="color:orangered;font-family:Lucida Console;font-size:9pt;">$keywordQuery<span style="color:darkgray;">.</span>SelectProperties<span style="color:darkgray;">.</span>Add(<span style="color:darkred;">&quot;ListItemID&quot;</span>); </span></p>
<p style="background:white;"><span style="color:orangered;font-family:Lucida Console;font-size:9pt;">$keywordQuery<span style="color:darkgray;">.</span>SelectProperties<span style="color:darkgray;">.</span>Add(<span style="color:darkred;">&quot;EditorOWSUSER&quot;</span>); </span></p>
<p style="background:white;"><span style="color:orangered;font-family:Lucida Console;font-size:9pt;">$keywordQuery<span style="color:darkgray;">.</span>SelectProperties<span style="color:darkgray;">.</span>Add(<span style="color:darkred;">&quot;ServerRedirectedURL&quot;</span>); </span></p>
<p style="background:white;"><span style="color:orangered;font-family:Lucida Console;font-size:9pt;">$keywordQuery<span style="color:darkgray;">.</span>SelectProperties<span style="color:darkgray;">.</span>Add(<span style="color:darkred;">&quot;ServerRedirectedEmbedURL&quot;</span>); </span></p>
<p style="background:white;"><span style="color:orangered;font-family:Lucida Console;font-size:9pt;">$keywordQuery<span style="color:darkgray;">.</span>SelectProperties<span style="color:darkgray;">.</span>Add(<span style="color:darkred;">&quot;ServerRedirectedPreviewURL&quot;</span>); </span></p>
<p style="background:white;"><span style="color:orangered;font-family:Lucida Console;font-size:9pt;">$keywordQuery<span style="color:darkgray;">.</span>SelectProperties<span style="color:darkgray;">.</span>Add(<span style="color:darkred;">&quot;SiteID&quot;</span>); </span></p>
<p style="background:white;"><span style="color:orangered;font-family:Lucida Console;font-size:9pt;">$keywordQuery<span style="color:darkgray;">.</span>SelectProperties<span style="color:darkgray;">.</span>Add(<span style="color:darkred;">&quot;SPSiteURL&quot;</span>); </span></p>
<p style="background:white;"><span style="color:orangered;font-family:Lucida Console;font-size:9pt;">$keywordQuery<span style="color:darkgray;">.</span>SelectProperties<span style="color:darkgray;">.</span>Add(<span style="color:darkred;">&quot;Path&quot;</span>); </span></p>
<p style="background:white;"><span style="color:orangered;font-family:Lucida Console;font-size:9pt;">$keywordQuery<span style="color:darkgray;">.</span>SelectProperties<span style="color:darkgray;">.</span>Add(<span style="color:darkred;">&quot;Title&quot;</span>); </span></p>
<p style="background:white;"><span style="color:orangered;font-family:Lucida Console;font-size:9pt;">$keywordQuery<span style="color:darkgray;">.</span>SelectProperties<span style="color:darkgray;">.</span>Add(<span style="color:darkred;">&quot;ParentLink&quot;</span>); </span></p>
<p style="background:white;"><span style="color:orangered;font-family:Lucida Console;font-size:9pt;">$keywordQuery<span style="color:darkgray;">.</span>SelectProperties<span style="color:darkgray;">.</span>Add(<span style="color:darkred;">&quot;IsContainer&quot;</span>); </span></p>
<p style="background:white;">&nbsp;</p>
<p style="background:white;">&nbsp;</p>
<p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:orangered;">$searchExecutor</span> <span style="color:darkgray;">=</span> <span style="color:blue;">new-object</span> <span style="color:blueviolet;">Microsoft.SharePoint.Client.Search.Query.SearchExecutor</span>(<span style="color:orangered;">$clientContext</span>) </span></p>
<p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:orangered;">$results</span> <span style="color:darkgray;">=</span> <span style="color:orangered;">$searchExecutor<span style="color:darkgray;">.</span>ExecuteQuery($keywordQuery</span>) </span></p>
<p style="background:white;"><span style="color:orangered;font-family:Lucida Console;font-size:9pt;">$clientContext<span style="color:darkgray;">.</span>ExecuteQuery() </span></p>
<p style="background:white;">&nbsp;</p>
<p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:darkgreen;">#This gives you all the documents that are shared with the user -&gt; &#39;testuser@domain.onmicrosoft.com&#39;</span> </span></p>
<p style="background:white;"><span style="color:orangered;font-family:Lucida Console;font-size:9pt;">$results<span style="color:darkgray;">.</span>Value </span></p>
<p style="background:white;"><span style="color:orangered;font-family:Lucida Console;font-size:9pt;">$results<span style="color:darkgray;">.</span>Value<span style="color:darkgray;">[<span style="color:purple;">0<span style="color:darkgray;">].</span>ResultRows </span></span></span></p>
<p style="background:white;">&nbsp;</p>
<p style="background:white;">&nbsp;</p>
<p style="background:white;"><span style="font-family:Lucida Console;font-size:9pt;"> </span>&nbsp;</p>]]></content:encoded>
    </item>
  </channel>
</rss>