Wednesday, December 09, 2015

How to get the current List GUID within your SharePoint Designer Workflow

You can get the Current List GUID by following the 4 simple steps below within your SharePoint Designer Workflow:

1) Use the "Extract substring from End of String" Action to copy 108 characters from the end of the Workflow Context: Workflow Status URL (Output to Variable:WorkflowStatusURLWithListGUID)

2) Use the "Extract substring from Start of String" Action to copy 44 characters from start of the WorkflowStatusURLWithListGUID (Output to Variable:ListGUID)

3) You can now use the Workflow Variable ListGUID within your custom actions or to construct dynamic strings where Current List GUID is required

For e.g. A Common use of the List GUID is when using workflows associated with SharePoint Calendar list and there is a requirement to export the SharePoint Event to *.ics file (so that the SharePoint Event can be added by user to his/her personal Outlook Calendar). To do this add a hyperlink to a URL similar to this within email Action:

<insert workflow context: current site url>/_vti_bin/owssvr.dll?CS=109&Cmd=Display&List=<insert List GUID here>&CacheControl=1&ID=<insert current item id here>&Using=event.ics

Friday, August 07, 2015

Convert Word documents to PDF in bulk using SharePoint 2013 Word Automation Services - PowerShell Script

Find below the PowerShell script to save PDF version of Word documents in a SharePoint 2013 document library. Take note of the input parameters and corresponding value in the script below, so that you can set your own value for this script to run properly

# Uncomment the line below if running this script within Windows PowerShell ISE
#Add-PSSnapin Microsoft.SharePoint.PowerShell

# Input parameters for the script
# Input the SharePoint list Name - replace Shared Documents with your Document Library Name
$listUrl="Shared Documents"

# Get the Word Automation Service Proxy
$wasp = Get-SPServiceApplicationProxy | where { $_.TypeName -eq "Word Automation Services Proxy" }

#Create the Conversion job
$conversionJob = New-Object Microsoft.Office.Word.Server.Conversions.ConversionJob($wasp)

# Get the web url
# Input the SharePoint URL - replace with your sharepoint site url
$web = Get-SPWeb ""

# Set the credentials to use when running the conversion job.
$conversionJob.UserToken = $web.CurrentUser.UserToken

# Conversion Job Name
$conversionJob.Name = "ConvertDOCXtoPDF1"
$conversionJob.Settings.OutputFormat = [Microsoft.Office.Word.Server.Conversions.SaveFormat]::PDF
$conversionJob.Settings.UpdateFields = $true
$conversionJob.Settings.OutputSaveBehavior = [Microsoft.Office.Word.Server.Conversions.SaveBehavior]::AlwaysOverwrite

#Get list
$list = $web.Lists[$listUrl]

# Replace the variable "SubFolderName" with your own folder name or remove SubFolders[..] if querying all files in root folder
foreach ($itm in $list.RootFolder.SubFolders["SubFolderName"].Files){
    # Replace .docx with .doc or other Word file extensions depending on the Word formats you are trying to convert
    if($itm.Name.ToLower().EndsWith(".docx") -eq $true) {
        Write-Host $($itm.ServerRelativeUrl)
        # Note the job below will convert all Word files to PDF and save it into the same location as where source Word document are. Modify code below to save to alternate location
        $conversionJob.AddFile($($web.Site.MakeFullUrl($itm.ServerRelativeUrl)), $($web.Site.MakeFullUrl($itm.ServerRelativeUrl).ToLower().Replace(".docx", ".pdf")))
# Start the conversion job

Saturday, June 06, 2015

Create a shortcut link to the "New Document" ribbon menu item to create a new document from a document template

The ribbon in SharePoint 2013 is useful but not user friendly if one is looking to create a document based on a pre-defined document template that is associated with a content type. Find below the code snippet that can be used to add a custom JQuery button or override existing script on button(s) to easily open a document based on a pre-defined Word template that is associated with the document library or content type:

Primary function

// Ensure that you replace the siteURL, docTemplateURL and docLibraryURL with your own values
// e.g. siteURL = http://intranet/
// e.g. docTemplateURL = http://intranet/doc%20ibrary/forms/template.docx
// e.g. docLibraryURL = http://intranet/doc%20ibrary
function createNewDocumentInstance(siteURL, docTemplateURL, docLibraryURL){

  var createDocumentURL = siteURL + "/_layouts/CreateNewDocument.aspx?id=" + docTemplateURL;

  // Invoke the internal SharePoint function to create a new document based on the document template
  createNewDocumentWithRedirect2(event, docTemplateURL, docLibraryURL, 'SharePoint.OpenDocuments', false, createDocumentURL, true, 0);


Possible Use (EXAMPLE Only)

function replaceAnchorTagOnClickEventAndHref(aTag, siteURL, docTemplateURL, docLibraryURL)
{ {
   // Handle home page hyperlink update to open new document instance based on content type
    createNewDocumentInstance(siteURL, docTemplateURL, docLibraryURL);
    return false;
  }); // End onclick event for aTag to open document in New Window
  aTag.attr("href", "#");
$(document).ready(function() {

  // Find the anchor tag that needs to be set with the onclick event
  // e.g. if the anchor text is set to 'My New Document Hyperlink'
  var aTag = $(".link-item a:contains('My New Document Hyperlink')");

  if (aTag.length > 0) {

Thursday, March 12, 2015

How to configure Yammer or a specific Yammer group to accept the post updated via email right away without sending back a confirmation email to the sender?

You can configure it through the admin control panel in Yammer.

Admin > Design and Configuration > below Email Settings, uncheck ''Require all users in your network to confirm their posts made by email before posting'' > then Save.


Thursday, March 05, 2015

How to implement your custom breadcrumb navigation in SharePoint 2013

You can easily add breadcrumb navigation to your SharePoint 2013 pages by including the following tag (and setting the associated properties) called "SharePoint:ListSiteMapPath" in your master page. Please note that "SharePoint:ListSiteMapPath" has property “SiteMapProviders” which means we can specify more than one  provider object with one ListSiteMapPath control
Add following code snippet to your Master Page content place holder (you can chose any one depending on where you want to position the breadcrumb navigation on the page), for e.g. you can add to "PlaceHolderPageTitleInTitleArea"










                PathSeparator="" />
Please note that you have to define your own stylesheets to implement the class "my-breadcrumb", "my-breadcrumbLink", "my-breadcrumbLinkCurrent" and "my-breadcrumbLinkRoot"

Thursday, February 12, 2015

How to resolve "Access is denied to the Secure Store Service." error in SharePoint 2013

You configure BCS and Secure Store Service correctly and then when trying to access the External list items, you may encounter a very strange error that reads something like this:
Unable to render the data. If the problem persists, contact your web server administrator.

Correlation ID:<some guid>

When you check your SharePoint error logs, you may notice some errors like this:

Secure Store Service ValidateCredentialClaims - Access Denied: Claims stored in the credentials did not match with the group claim for a group app. 

Secure Store Service           Secure Store                   GetRestrictedCredentials failed with the following exception: System.ServiceModel.FaultException`1[Microsoft.Office.SecureStoreService.Server.SecureStoreServiceFault]: Access is denied to the Secure Store Service. (Fault Detail is equal to Microsoft.Office.SecureStoreService.Server.SecureStoreServiceFault). <some guid>

The best way to resolve this issue is to check the configured Target Application ID, especially "Members - The users and groups that are mapped to the credentials defined for this Target Application." and ensure proper user or group is entered (by clicking the "Edit" option on the Target Application in under Secure Store Service Application Administration screen -  Central Admin > Application Management > Manage Service Applications > Secure Store Service and Edit the Target Application ID > Click on Next till you get to the third page and set the field "Members" with the proper users/groups who will access this External list from SharePoint - in my example I set to "All Users")

Friday, February 06, 2015

How to Remove Page Title next to the logo in SharePoint 2013

Here is a quick tip on how you can Remove Page Title next to the logo in SharePoint 2013. Add to the end of your custom stylesheet for your SharePoint 2013 theme (typically in the Style Library) { display: none; } /* hide page title next to the logo */

Monday, January 19, 2015

How to solve Office 365 SharePoint Online error "Sorry you're not set up to follow" when you try to Follow a Document or Site. Unfortunately, it looks like your account hasnt't been set up to follow documents or sites."

In Office 365, you may have encountered this strange error where it throws an error "Sorry you're not set up to follow" when you try to Follow a Document or Site. There might be more information about the above error message such as "Unfortunately, it looks like your account hasnt't been set up to follow documents or sites."
The way to solve this issue is to login as Office 365 Global Administrator account to SharePoint Online Administration and navigate to the following - User Profiles -> People -> Manage User Permissions and enable the following checkboxes for the group "Everyone except external users"
Wait for 5-10 mins and VOILA! your users will now be able to follow sites and documents.