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.

Monday, February 23, 2015

PowerShell - Delete Duplicate Quick Launch Nodes

Scenario:
  • Site slow to load, resulting in an exception with a correlation ID
  • ULS log error: PortalSiteMapProvider was unable to fetch children for node at URL
  • Temporarily hide the quick launch so users can navigate to the site: SharePoint Designer 2010 > http://samplesite > Left Nav > 'Sample Site Name' > uncheck 'Display Quick Launch' > Save.
  • Find the offending Quick Launch node by running the following SQL query against the content database. You should see many, many repeating entries: SELECT * FROM NavNodes
  • Delete the repeats from the Quick Launch via PowerShell:
    $FindString = “Offending Sample Title”
    $web = get-spweb ("http://samplesite/")
    for ($i = $web.Navigation.QuickLaunch.Count-1; $i -ge 0; $i--)
    {
    write-host $web.Navigation.QuickLaunch[$i].Title "heading deleting...... "
    $web.Navigation.QuickLaunch[$i].Delete()
    write-host "heading deleted successfully !!!."
    }
  • Display the quick launch again.

Resources:

Tuesday, January 27, 2015

PowerShell - No Ellipses

No Ellipses:

| Format-Table -AutoSize

Tuesday, January 13, 2015

Excel 2013 - Freeze Top Row and First Column

Click B2 > Ribbon > View tab > Freeze Panes

Tuesday, January 6, 2015

PowerShell - SharePoint Database Size Report

$SMTPServer = "" 
$emailFrom = "" 
$emailTo = "" 
$subject = "Sharepoint DB Size Report"

$total = ""
$each = Get-SPDatabase | Sort-Object disksizerequired -desc | ForEach-Object {$db=0} {$db +=$_.disksizerequired; $_.name + " - " + ("{0:n0}" -f ($_.disksizerequired/1024/1024)) + "`t"} {$total = "`nTotal Storage (in MB) =" + ("{0:n0}" -f ($db/1024/1024))}
$each = Out-String -InputObject $each
$total = Out-String -InputObject $total

$emailBody = "SharePoint DB - Size in MB" + "`n" + "`n" + $each + $total

Send-MailMessage -SmtpServer $SMTPServer -From $emailFrom -To $emailTo -Subject $subject -Body $emailBody


Resources:
http://www.toddklindt.com/blog/Lists/Posts/Post.aspx?ID=193

Tuesday, December 9, 2014

Excel Services: Configure a workbook to use the unattended service account


'Data' tab > 'Connections' > data connection > 'Properties' > 'Definition' tab > 'Authentication Settings' button > 'None' radio button > OK > OK > Close.
 
With the Excel Services Authentication Settings set to None, Excel Services uses the unattended service account to refresh the data in the workbook after you have published it to SharePoint Server 2013.

Resources:
http://technet.microsoft.com/en-us/library/hh525344%28v=office.15%29.aspx

Monday, November 24, 2014

Application Pools Not Starting After Reboot

IIS Manager > Computer Name > Configuration Editor > Section dropdown > system.applicationhost > application pools > (Collection) > eclipses (…) > select application pool > startMode > AlwaysRunning.

Source:
http://msdn.microsoft.com/en-us/library/ee677285%28v=azure.10%29.aspx

Tuesday, September 30, 2014

Copying/Moving SharePoint 2010 Designer Workflows



Consolidated directly from:

http://chanakyajayabalan.wordpress.com/2012/01/02/copyingmoving-sharepoint-2010-designer-workflows/



  1. In the first(source) site, create the required workflow and publish it.
  2. Now select Export to Visio option which allows you to save the workflow with a .vwi extension. (Refer this workflow hereafter as source workflow).
  3. Now go to the destination site where you want the workflow to be copied, and create a new workflow with the same name as the previous one & publish it.
  4. Now select Export to Visio option which allows you to save the workflow with a .vwi extension. (Refer this workflow hereafter as Destination workflow).
  5. Now you will be having two .vwi files (one of source workflow’s – SourceWorkflowName.vwi and other of the destination workflow’s – DestinationWorkflowName.vwi). Now add .zip extension to both the files. Now your files names should be SourceWorkflowName.vwi.zip & DestinationWorkflowName.vwi.zip.
  6. Now open both the zip files, copy workflow.xoml.wfconfig.xml from destination workflow to source workflow. (Its destination to source and not source to destination).
  7. From now on, we will not use the file DestinationWorkflowName.vwi.zip. So ignore that file.
  8. Remove the .zip extension from SourceWorkflowName.vwi.zip which gives you the SourceWorkflowName.vwi file.
  9. Now, go to the destination site, open workflows and click Import from Visio and browse to the SourceWorkflowName.vwi file.
  10. That’s it and your workflow is copied. You can publish the workflow and run it.
PS : In case if your list’s GUID’s (for those lists that you have used in workflow – tasks list, history list or any other lists used in workflow steps) have been changed from source & destination site, you may need to update those steps in the workflow.

-----

Instead of creating zip files, just open the source and destination workflows in SPD and overwrite the wfconfig file from source to destination from All files option in SPD and thats it!

Export Multiple Lists into a Single Excel File

This is simply a copy of a clever TechNet Forum answer for reference:


After you click Export to Excel and open the owssvr.iqy for the first list, do not close the Excel file, change the connection name from owssvr to something else in Data->Connections->Properties.
go to the next list and click Export to Excel, choose new worksheet instead of new workbook. And rename the connection to the second list from owssvr to something else as before.
This way, you will get one data connection for each list in the same workbook. Save the workbook back to .xls after finishing the last list.

Tuesday, August 26, 2014

PowerShell - Get-SPLogEvent

get-splogevent -StartTime "08/26/2014 01:00" -EndTime "08/26/2014 14:00" |?{$_.Correlation -eq "8b49fbf8-7da2-43k7-ad49-5p02277bc598"} | select Timestamp, Area, Category, Level, EventID, Message | Format-List

Friday, August 22, 2014

Blog - Post.aspx - Intermittent Unable to display this Web Part

Intermittent on Blog Post.aspx:

Unable to display this Web Part. To troubleshoot the problem, open this Web page in Microsoft SharePoint Foundation-compatible HTML editor such as Microsoft SharePoint Designer. If the problem persists, contact your Web server administrator.
Correlation ID

-----
$myfarm = Get-SPFarm
$myfarm.XsltTransformTimeOut
1
-----
$myfarm.XsltTransformTimeOut = 5
$myfarm.Update()
------

Reference:
http://thechriskent.com/2012/06/18/intermittent-unable-to-display-this-web-part-messages/

Friday, August 8, 2014

ItemStyle.xsl - All Field Names

<xsl:for-each select="@*">
    Field Name :<xsl:value-of select="name()" />
</xsl:for-each>

Monday, July 28, 2014

InfoPath 2010 - Web Browser Form

'File' > 'Info' > 'Advanced form options' (At the bottom) > 'Form Options' > 'Compatibility' > 'Form type: Web Browser Form'