Posts

Export and Import SharePoint Designer List Workflow

Exporting and importing of the List Workflow to and from another list or site is actually a non-supported feature. However, there is a "workaround" to achieve this.  In SharePoint Designer 2010, click on your completed List Workflow. Click on "Save" and "Publish" for the completed List Workflow. Next, click on "Export to Visio". Save the file as CompletedWorkflow.vwi or any preferred name. Then create a new "similar" list on the current site or on a new site collection. There is no way to import the exported visio into this new list. In SharePoint Designer 2010, click on this new list and then click on "List Workflow" to create a new workflow for this new list. Please make sure that you do not add any workflow steps! Click on "Save" and "Publish" for this empty List Workflow. Then, click on "Export to Visio" and save this as EmptyWorkflow.vwi or any preferred name. Rename both the...

InfoPath form Contact selector

 The Contact Selector consists of 3 data nodes: DisplayName AccountId AccountType Each is just a text field.  When you publish your form, you have the option of promoting one or all of the fields. DisplayName only contains the PreferredName attribute of the User Profile Database, which is typically in the form of LastName, FirstName, but it depends on your AD setup. AccountId is the most valuable field, because it contains the user's domain name in the form of domain\username (i.e. microsoft\userId).  If you promote this field to SharePoint, then this value is immediately usable for sending workflow emails in SharePoint Designer.  I do this all the time.  Also, that value can have the domain portion stripped out and be used to query the GetUserProfileByName web method to retrieve the selected user's profile info, including Email Address, Manager, Department, and many other attributes stored in the profile database. Since these are text fields, th...

ECMA Script : To get current logged in user information from User Profile Service Application

ECMA Script to get current logged in user information from User Profile Service Application using "SP.UserProfiles" script files. <!--script src="/_layouts/15/Scripts/MicrosoftAjax.js" type="text/javascript"></script--> <!--script src="/_layouts/15/init.js" type="text/javascript"></script--> <script src="/_layouts/15/sp.runtime.js" type="text/javascript"></script> <script src="/_layouts/15/sp.js" type="text/javascript"></script> <script src="/_layouts/15/SP.UserProfiles.js" type="text/javascript"></script> <script type="text/javascript">     //$(document).ready(function(){         SP.SOD.executeOrDelayUntilScriptLoaded(getUserProperties, 'SP.UserProfiles.js');     //});     var userProfileProperties;     function getUserProperties() {         var clientContext = new SP.ClientConte...

ECMA Script : To Add current logged in user to SharePoint group 2013/ 2010

<html xmlns="http://www.w3.org/1999/xhtml"> <head> <script type="text/ecmascript"> ExecuteOrDelayUntilScriptLoaded(init,'sp.js'); var currentUser; var currentUserName; var currentUserEmail; var currentUserLogin; var siteUrl = '/'; function init(){     var clientContext = new SP.ClientContext.get_current();     var oWeb= clientContext.get_web();           currentUser = oWeb.get_currentUser();     clientContext.load(currentUser);     clientContext.executeQueryAsync(Function.createDelegate(this,this.onQueryUNSucceeded), Function.createDelegate(this,this.onQueryUNFailed)); } function onQueryUNSucceeded() {   currentUserName = currentUser.get_title(); currentUserLogin= currentUser.get_loginName(); currentUserEmail= currentUser.get_email(); document.getElementById('txtUserName').innerHTML =  currentUserName; document.getElementById('txtloginName').innerHTML =  curr...

Get relative path and name of the active Script in PowerShell

# Get complete file path (eg: D:\RootFolder\ActiveScript.ps1) $0 = $MyInvocation.MyCommand.Definition # Get current Directory file path (eg: D:\FolderA) $dp0 = [System.IO.Path]::GetDirectoryName($0) #To Get the root folder $RootPath = $dp0 | split-path # Get current Drive (eg: D:\) $bits = Get-Item $dp0 | Split-Path -Parent

Check Running Timerjob Status using Powershell

Check the status of timer jobs that have been run by using Windows PowerShell. $Job = Get-SPTimerjob "TimerJob Name" [Array] $JobHistoryList=$Job.HistoryEntries Start-SPTimerJob $Job Write-Host "Running Timer Job" -NoNewline $count = $JobHistoryList.count $countNext = $count+1 while ( $countNext -ne $count) { [Array] $JobHistoryList=$Job.HistoryEntries $count = $JobHistoryList.count Write-Host "." -NoNewline sleep 2 } if ($taxonomyjob[0].status –ne "Succeeded") { Write-Host -f yellow $JobHistoryList[0].status Write-Host -f yellow $JobHistoryList[0].ErrorMessage } else { Write-Host $JobHistoryList[0].status }

"The Selected file was not found” Error When Adding an Attachment to an InfoPath Form

Adding the following bit of JavaScript to the WrkTaskIP.aspx page, which is responsible for hosting the InfoPath task form: <script type="text/javascript"> aspnetForm.encoding = "multipart/form-data"; </script> Another approach documented here suggests modifying the application.master master page file to add the necessary enctype form tag: <form runat="server" onsubmit="return _spFormOnSubmitWrapper();" enctype="multipart/form-data"> ... </form