TwitterLinkedInBlog

Friday, October 21, 2016

Document ID nasty error, easy fix

Document ID nasty error, easy fix:

Nasty error:
Could not look up Document ID due to an error encountered in Microsoft Search Server. Scope in your query does not exist.

Easy fix:
Site settings > Site Collection Administration > Document ID settings > Use this search scope for ID lookup: 'All Sites' > OK.




Tuesday, February 9, 2016

SharePoint 2013 PowerShell - Everyone Unfollow Everyone

$site = Get-SPSite "http://mySiteCollection/"
$serviceContext = Get-SPServiceContext($site)
$profileManager = new-object Microsoft.Office.Server.UserProfiles.UserProfileManager($serviceContext)

foreach($userProfile in $profileManager.GetEnumerator())
{
    $followingManager = new-object Microsoft.Office.Server.Social.SPSocialFollowingManager($userProfile, $serviceContext)
    $followed = $followingManager.GetFollowed("Users")
    $actorInfo = new-object Microsoft.Office.Server.Social.SPSocialActorInfo
 
    foreach($user in $followed)
    {    
        write-host $userProfile.AccountName 'follows' $user.AccountName
        $actorInfo.AccountName = $user.AccountName
        $actorInfo.ActorType = "User"
        $followingManager.StopFollowing($actorInfo)
    }
}

Friday, May 15, 2015

InfoPath 2013 - Project location for Visual Basic and C# code

Does not seem to stick for me today:
File > Advanced form options: Form Options (large square button) > Programming > Project location for Visual Basic and C# code:

Use this instead:
File > Options (left nav) > General > 'More Options' button > 'Design' tab > Project location for Visual Basic and C# code:


Wednesday, May 13, 2015

Failed to connect to the existing server farm

Verify that the SQL Alias matches Central Administration > System Settings > Manage servers in this farm > Microsoft SharePoint Foundation Database:

Start > Run > cliconfg.exe > 'Alias' tab > 'Add...' button > 'TCP/IP' radio button > Server name: SAMPLESERVERNAME\SAMPLEINSTANCENAME > Server alias: SAMPLEALIAS > OK.

Wednesday, April 22, 2015

SP2013 - web.config debug settings

inetpub\wwwroot\wss\VirtualDirectories\80\web.config
15\TEMPLATE\LAYOUTS\web.config
15\CONFIG\web.config
15\TEMPLATE\ADMIN\web.config

<configuration>
  <SharePoint>
    <SafeMode CallStack="true" />
  </SharePoint>
  <system.web>
    <customErrors mode="Off" />
    <compilation debug="true" />
  </system.web>
</configuration>

Thursday, February 26, 2015

PowerShell - Find Content Type in Use

$siteURL = http://sample/
$contentType = "Sample"
$web = Get-SPWeb $siteURL
$ct = $web.ContentTypes[$contentType]
if ($ct) {
$ctusage = [Microsoft.SharePoint.SPContentTypeUsage]::GetUsages($ct)
      foreach ($ctuse in $ctusage) {
        $list = $web.GetList($ctuse.Url)
        $contentTypeCollection = $list.ContentTypes;
        #$contentTypeCollection.Delete($contentTypeCollection[$ContentType].Id);
        Write-host "(Would have) Deleted -" $contentType "- content type from -" $ctuse.Url "-"
        }
#$ct.Delete()
Write-host "(Would have) Deleted -" $contentType "- from site."
} else { Write-host "Nothing to delete." }
$web.Dispose()


Reference:
http://stackoverflow.com/questions/6427315/unable-to-delete-sharepoint-2010-contenttype-contenty-type-in-use

Tuesday, February 24, 2015

PowerShell - Merge-SPLogFile

$logPath = "C:\MergedULSLogs\log.txt"
$startTime = "02/23/2015 07:50"
$endTime = "02/23/2015 07:59"
$correlationID = "a9afa74b-119f-46bf-aea8-ec2d886ee490"

Merge-SPLogFile -Path $logPath -Overwrite -StartTime $startTime -EndTime $endTime -Correlation $correlationID

Then open the log.txt file with ULS Viewer.