Deploying a Reusable Workflow to a List Content Type using PowerShell

We have a situation where deployment of a reusable workflow for a site content type cannot be completed through the web interface due to the number of libraries where the content type is in use (time-out on deploy and update).
It was hoped that this could be accomplished with PowerShell but the method of deploying to a list content type appears to be different than it is to a list (all content types).
The below snippet works fine for a list / all content types:
function AddWorkflowToLibraries ($SiteCollection, $ctName, $WfName, $WfAssociationName)
$site = Get-SPSite $SiteCollection
[Guid]$wfTemplateId = New-Object Guid
#Step through each web in site collection
$site | Get-SPWeb -limit all | ForEach-Object {
$web = $_
$_.Lists | ForEach-Object{
if($_.AllowContentTypes -eq $true)
if($_.ContentTypes.Item("$ctName") -ne $null)
write-host "Enabling workflow on" $_.Title "in" $_.ParentWebUrl
$ct = $_.ContentTypes[$ctName]
$culture = New-Object System.Globalization.CultureInfo("en-US")
$template = $site.RootWeb.WorkflowTemplates.GetTemplateByName($WfName, $culture)
if($template -ne $null)
$tasklist = "Tasks"
$historylist = "Workflow History"
if(!$web.Lists[$historylist])
$web.Lists.Add($historylist, "A system library used to store workflow history information that is created in this site. It is created by the Publishing feature.",
"WorkflowHistory", "00BFEA71-4EA5-48D4-A4AD-305CF7030140", 140, "100")
if (!$web.Features["00BFEA71-4EA5-48D4-A4AD-305CF7030140"]) {
Enable-SPFeature -Identity WorkflowHistoryList -Url $web.Url
$wfHistory = $web.Lists[$historylist]
$wfHistory.Hidden = $true
$wfHistory.Update()
if(!$web.Lists[$tasklist])
$web.Lists.Add($tasklist, "This system library was created by the Publishing feature to store workflow tasks that are created in this site.", "WorkflowTasks", "00BFEA71-A83E-497E-9BA0-7A5C597D0107", 107, "100")
$association = [Microsoft.SharePoint.Workflow.SPWorkflowAssociation]::CreateListAssociation($template, $wfName, $web.Lists[$tasklist], $web.Lists[$historylist])
$association.AllowManual = $true
$_.AddWorkflowAssociation($association)
$_.Update()
else
Write-Error "Workflow Template not found"
AddWorkflowToLibraries <Site Name> <Content Type Name> <Workflow Template Name> <Association Name>
However changing the association as follows causes the script to still execute without a problem but the workflow doesn't appear for the content and the associations collection is empty:
function AddWorkflowToLibraries ($SiteCollection, $ctName, $WfName, $WfAssociationName)
$site = Get-SPSite $SiteCollection
[Guid]$wfTemplateId = New-Object Guid
#Step through each web in site collection
$site | Get-SPWeb -limit all | ForEach-Object {
$web = $_
$_.Lists | ForEach-Object{
if($_.AllowContentTypes -eq $true)
if($_.ContentTypes.Item("$ctName") -ne $null)
write-host "Enabling workflow on" $_.Title "in" $_.ParentWebUrl
$ct = $_.ContentTypes[$ctName]
$culture = New-Object System.Globalization.CultureInfo("en-US")
$template = $site.RootWeb.WorkflowTemplates.GetTemplateByName($WfName, $culture)
if($template -ne $null)
$tasklist = "Tasks"
$historylist = "Workflow History"
if(!$web.Lists[$historylist])
$web.Lists.Add($historylist, "A system library used to store workflow history information that is created in this site. It is created by the Publishing feature.",
"WorkflowHistory", "00BFEA71-4EA5-48D4-A4AD-305CF7030140", 140, "100")
if (!$web.Features["00BFEA71-4EA5-48D4-A4AD-305CF7030140"]) {
Enable-SPFeature -Identity WorkflowHistoryList -Url $web.Url
$wfHistory = $web.Lists[$historylist]
$wfHistory.Hidden = $true
$wfHistory.Update()
if(!$web.Lists[$tasklist])
$web.Lists.Add($tasklist, "This system library was created by the Publishing feature to store workflow tasks that are created in this site.", "WorkflowTasks", "00BFEA71-A83E-497E-9BA0-7A5C597D0107", 107, "100")
$association = [Microsoft.SharePoint.Workflow.SPWorkflowAssociation]::CreateListContentTypeAssociation($template, $wfName, $web.Lists[$tasklist], $web.Lists[$historylist])
$association.AllowManual = $true
$_.ContentTypes[$ctname].AddWorkflowAssociation($association)
$_.ContentTypes[$ctname].Update()
else
Write-Error "Workflow Template not found"
AddWorkflowToLibraries <Site Name> <Content Type Name> <Workflow Template Name> <Association Name>
The only change is:
$association = [Microsoft.SharePoint.Workflow.SPWorkflowAssociation]::CreateListContentTypeAssociation($template, $wfName, $web.Lists[$tasklist], $web.Lists[$historylist])
$association.AllowManual = $true
$_.ContentTypes[$ctname].AddWorkflowAssociation($association)
$_.ContentTypes[$ctname].Update()
But unlike the list version, the association doesn't appear to be saved and no error is generated.
Is anyone aware of what may cause this or have an example in C# that may explain something my script is missing?

Hi Garry,
After you associate the workflow to the content type, you should update the update the content type using
$ct.UpdateWorkflowAssociationsOnChildren($true,$true,$true,$false)
 method.
Here is the completed script:
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
$site=Get-SPSite "http://serverName"
$web=$site.OpenWeb()
$list=$web.Lists["ListC"]
$taskList=$web.Lists["Tasks"]
$historyList=$web.Lists["Workflow History"]
$ct=$list.ContentTypes["Link"]
$culture=New-Object System.Globalization.CultureInfo("en-US")
$wfTemplate=$web.WorkflowTemplates.GetTemplateByName("Three-State",$culture)
$associationWF=[Microsoft.SharePoint.Workflow.SPWorkflowAssociation]::CreateListContentTypeAssociation($wfTemplate, "myThreeStateWF",$taskList,$historyList)
$ct.WorkflowAssociations.Add($associationWF)
$ct.UpdateWorkflowAssociationsOnChildren($true,$true,$true,$false)
Here is a demo about how to update it using C#
http://www.thorntontechnical.com/tech/sharepoint/sharepoint-2010-associate-workflow-to-content-type-in-a-feature
Wayne Fan
TechNet Community Support

Similar Messages

  • Trying to un-hide content type using powershell

    I'm using this script below and am writing back the library name and if the content type is hidden after the update.
    Everything points to being correct yet when I go back to the library settings the eDocument Link is still hidden. What am I missing?
    add-pssnapin microsoft.sharepoint.powershell -ErrorAction SilentlyContinue
    $script:WebApps = Get-SPWebApplication "http://xxxx"
    $script:DocLibType = [Microsoft.SharePoint.SPBaseType]::DocumentLibrary
    foreach ($WebApp in $WebApps)
    foreach ($site in $WebApp.Sites)
    if ($site.AllWebs.Count -gt 0)
    foreach ($web in $site.AllWebs)
    foreach ($list in $web.GetListsOfType($DocLibType))
    foreach ($ct in $list.ContentTypes)
    if ($ct.Name.Equals("eDocument Link"))
    $ct.Hidden=$false;
    $ct.Update();
    $List.Update()
    Write-host "$site:: $web:: $List updated"
    Write-host $ct.Hidden
    $web.Dispose()
    $site.Dispose()
    SPSite Url=http://xxxx/team/is:: xxxx:: Active updated
    False
    SPSite Url=http://xxxx/team/is:: xxxx:: Documents updated
    False

    that's what you already checked in your loop 
    if ($ct.Name.Equals("Wibble"))
    the updated is because you already added the new content type at the start of the new item menu so this will make sure that you will add it to the end and ignore the first entry as if you add list contains duplicate content type you will get exception at
    the line 
    $list.RootFolder.UniqueContentTypeOrder=$ct_list
    Hope that helps|Amr Fouad|MCTS,MCPD sharePoint 2010

  • Multiple "Workflow Task (SharePoint 2013)" content type found

    Users on one specific sub-site reported that they are unable to add site columns to content type. When user clicks "add existing site column" user get error message - upon looking up on ULS, it indicate there were duplicate column "System.ArgumentException:
    No two choices should have the same ID". I came across similar issue on different site before and resolved it by deleting duplicate column, plus that site column was not used on any list or associated with any content type but this time duplicate
    column is "Task outcome" column which is associated with "Workflow Task(SharePoint2013)" content type. So looking up these two specific site column and content type I noticed there are 8 occurrence of each at affected site
    level (see below on image).
    Similarly there are 8 "Task Outcome" columns under Site Columns. So I refreshed staging env with prod copy and tried to delete "Workflow Task(SharePoint 2013" content type and got error message as shown below. Under Site features, I noticed
    "SharePoint 2013 Task List" feature was enabled, hoping this will do the trick I disabled it as we still use SharePoint 2010 workflows, but to no avail.
    Sorry, something went wrong
    The content type "Workflow Task (SharePoint 2013)" is part of an application feature.
    Not sure how it got started and something will try to find out but any advise on how to fix this issue?
    Thanks,
    MK Sin

    Hi Sin,
    According to your description, my understanding is that the users got an error when clicking “add existing site column”.
    For deleting the duplicate “Task outcome”column, you need to go to the “Workflow Task(SharePoint 2013)” content type, click the “Task outcome” column, and remove it from the content type.
    Then go to site columns, find the duplicate columns, and delete them and make sure only one “Task outcome” column exists.
    After the above, re-add the “Task outcome” into the “Workflow Task(SharePoint 2013)” content type.
    Best Regards,
    Wendy
    Wendy Li
    TechNet Community Support

  • SP 2013 Workflow Associations - get the content type for associated tasks with PowerShell

    I am creating a PowerShell script to document SharePoint 2013 workflow associations on a site. I can get the Subscription object for the workflow association, but I can't figure out how to dig into it to find out the Content Type for tasks generated
    by workflows created by this WF association. I can get the Task List ID from the Subscription.PropertyDefinitions, and from there can get the Task List. But the task list may use many different content types, because when you associate a 2013 workflow
    to a list, SharePoint adds the workflow's content type to the set of content types used by the workflow task list. If you have a lot of workflows that use the same task list, that task list gets a lot of content types.
    I have the Subscription object for the workflow association. How can I divine the content type for tasks that the workflow will generate?
    Leigh Webber

    I would suggest you to consider using the SPListItem that running the workflow instance to check the task content type.
    First, find the list item that associated with the workflow, then SPListItem.Tasks returns a collection of workflow tasks for the item, you can check the content type from the task item.
    Qiao Wei
    TechNet Community Support

  • Apply workflow to approval task content type

    Here's the backstory. I created an OOB Approval Workflow which created a content type called "Approval Workflow Task (en-US)". I created a new site column called Contract. I applied this site column to the Approval Workflow Task (en-US) content
    type. Now I want to setup a workflow which will automatically populate this Contract field.
    The problem is that in SharePoint designer I setup a list workflow to work across all items in the Task list, but it won't apply to this new content type for some reason. If I got to this content type in designer, there is not an option to apply a workflow
    to it. It looks like this content type is in a group called _hidden, but when I change this, it doesn't look like anything happens.
    Am I missing something?

    Hi Mike,
    When we create a List Workflow in SharePoint Designer, then the workflow will be associated with the list and it will not be associated with the content types.
    Per my test, we cannot start the workflow manually on the Tasks items which have been created based on the Approval workflow content type.
    However, we can set the workflow to start automatically when an new item is created.
    To start the workflow automatically when an item is created, please open the workflow in SharePoint Designer > go to the workflow settings page > select Start workflow automatically when an item is created.
    Best regards.
    Victoria
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Search for documents using External Data on list content type

    hi,
    say we have clients in an external database, we create the external content type for use in sharepoint 2013
    we create two content types, Quote and Order for use in a library
    we create a document library that uses the above content types
    we then add a column for the external data ( in this case Client Name- but also include ID) , we have the option to copy to content type selected. so now library shows 'Client' and 'Client:ID'
    I believe that column gets added to  list content types based on the 2 document content types.
    so we have list items , which have a document , a content type and a piece of data from the external LOB system.
    now that is fine, works great, however, how do you configure the content search web part to return documents based on the piece of external data - ie client:ID ? or Client Name ?
    I can map the client:ID to one of the Int00 managed properties and crawl etc - but do not see a way to use that to return documents
    any help would be appreciated :)
    thanks
    MrP

    Create a scopr with that in managed properies and then u can get results from  external sources

  • Missing Columns from List Content Type

    Hi,
    I'm having some strange problems with one of my site collections, I have site content types with a few columns in it and I'm using them in 3 different libraries.
    However recently something happened and it seems the list content types in one of the libraries have stopped using some of the columns set out in the site content type (according to library settings). The columns still show as part of the list (and the metadata
    is still in there), when I've tried adding them back to the list content types, I do not see them in the list columns group, only in their original column group. If I try to add them to the list from their original group I get the errors similar to the following:
    11.14.2014 13:16:52.85 w3wp.exe (0x1B84)
    0x0770 SharePoint Foundation
    General 8e2s
    Medium Unknown SPRequest error occurred. More information: 0x8007054f
    fd09cc9c-cf7b-1059-3bcb-0e44d3bf3743
    11.14.2014 13:16:52.85 w3wp.exe (0x1B84)
    0x0770 SharePoint Foundation
    General aix9j
    High SPRequest.AddField: UserPrincipalName=, AppPrincipalName= ,bstrUrl=http://servername/sitecollection ,bstrListName={7F184ACA-48C3-4728-AF42-A12CB55941B4} ,bstrSchemaXml=<Field Type="Lookup" DisplayName="DocumentOwner"
    Required="FALSE" EnforceUniqueValues="FALSE" List="{57d71ec0-a996-4977-abf7-4cd4e0cc105c}" WebId="53a31862-077a-4031-8aad-7f2a43e33a46" ShowField="Title" UnlimitedLengthInDocumentLibrary="FALSE" Group="_QMS"
    ID="{ca4bc17d-bb96-4aee-bb96-e645c939a013}" ,grfAdd=18
    fd09cc9c-cf7b-1059-3bcb-0e44d3bf3743
    11.14.2014 13:16:52.85 w3wp.exe (0x1B84)
    0x0770 SharePoint Foundation
    General ai1wu
    Medium System.Runtime.InteropServices.COMException: An internal error occurred. (Exception from HRESULT: 0x8007054F), StackTrace:    at Microsoft.SharePoint.SPFieldCollection.AddFieldAsXmlInternal(String
    schemaXml, Boolean addToDefaultView, SPAddFieldOptions op, Boolean isMigration, Boolean fResetCTCol)     at Microsoft.SharePoint.ApplicationPages.AddFieldToContentTypePage.AddFieldToList(SPField fldSrc)     at Microsoft.SharePoint.ApplicationPages.AddFieldToContentTypePage.UpdateList()
        at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)     at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)     at System.Web.UI.Page.ProcessRequest(Boolean
    includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)     at System.Web.UI.Page.ProcessRequest()     at System.Web.UI.Page.ProcessRequest(HttpContext context)     at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
        at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)     at System.Web.HttpApplication.PipelineStepManager.ResumeSteps(Exception error)     at System.Web.HttpApplication.BeginProcessRequestNotification(HttpContext
    context, AsyncCallback cb)     at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context)     at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer,
    IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)     at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)     at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr
    pHandler, RequestNotificationStatus& notificationStatus)     at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus& notificationStatus)     at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr
    rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)     at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
    fd09cc9c-cf7b-1059-3bcb-0e44d3bf3743
    11.14.2014 13:16:52.85 w3wp.exe (0x1B84)
    0x0770 SharePoint Foundation
    General 8nca
    Medium Application error when access /_layouts/15/fldpick.aspx, Error=An internal error occurred. (Exception from HRESULT: 0x8007054F)   at Microsoft.SharePoint.Library.SPRequestInternalClass.AddField(String
    bstrUrl, String bstrListName, String bstrSchemaXml, Int32 grfAdd)     at Microsoft.SharePoint.Library.SPRequest.AddField(String bstrUrl, String bstrListName, String bstrSchemaXml, Int32 grfAdd)
    fd09cc9c-cf7b-1059-3bcb-0e44d3bf3743
    11.14.2014 13:16:52.85 w3wp.exe (0x1B84)
    0x0770 SharePoint Foundation
    Runtime tkau
    Unexpected System.Runtime.InteropServices.COMException: An internal error occurred. (Exception from HRESULT: 0x8007054F)    at Microsoft.SharePoint.Library.SPRequestInternalClass.AddField(String bstrUrl,
    String bstrListName, String bstrSchemaXml, Int32 grfAdd)     at Microsoft.SharePoint.Library.SPRequest.AddField(String bstrUrl, String bstrListName, String bstrSchemaXml, Int32 grfAdd)
    fd09cc9c-cf7b-1059-3bcb-0e44d3bf3743
    11.14.2014 13:16:52.85 w3wp.exe (0x1B84)
    0x0770 SharePoint Foundation
    General ajlz0
    High Getting Error Message for Exception System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> Microsoft.SharePoint.SPException: An internal error
    occurred. (Exception from HRESULT: 0x8007054F) ---> System.Runtime.InteropServices.COMException: An internal error occurred. (Exception from HRESULT: 0x8007054F)     at Microsoft.SharePoint.Library.SPRequestInternalClass.AddField(String bstrUrl,
    String bstrListName, String bstrSchemaXml, Int32 grfAdd)     at Microsoft.SharePoint.Library.SPRequest.AddField(String bstrUrl, String bstrListName, String bstrSchemaXml, Int32 grfAdd)     --- End of inner exception stack trace ---  
      at Microsoft.SharePoint.SPGlobal.HandleComException(COMException comEx)     at Microsoft.SharePoint.Library.SPRequest.AddField(String bstrUrl, String bstrListName, String bstrSchemaXml, Int32 grfAdd)     at Microsoft.SharePoint.SPFieldCollection.AddFieldAsXmlInternal(String
    schemaXml, Boolean addToDefaultView, SPAddFieldOptions op, Boolean isMigration, Boolean fResetCTCol)     at Microsoft.SharePoint.ApplicationPages.AddFieldToContentTypePage.AddFieldToList(SPField fldSrc)     at Microsoft.SharePoint.ApplicationPages.AddFieldToContentTypePage.UpdateList()
        at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)     at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)     at System.Web.UI.Page.HandleError(Exception
    e)     at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)     at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
        at System.Web.UI.Page.ProcessRequest()     at System.Web.UI.Page.ProcessRequest(HttpContext context)     at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()    
    at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
    fd09cc9c-cf7b-1059-3bcb-0e44d3bf3743
    I've tried to make changes to the parent site content type, however those changes to not push down to the library in question. The missing columns have varied types (single line of text, lookup, managed metadata and so forth). All of these content types &
    site columns were created through the user interface of SharePoint.
    Can anyone help me with any ideas what has happened and/or how to fix this problem?

    Hi Hans,
    As I understand, you have custom content type in 3 libraries, while the issue occurs to the columns in this content type.
    I wonder if the issue occurs to other two libraries as well?
    From your description, "I've tried to make changes to the parent site content type, however those changes to not push down to the library in question", do you mean that changes in content type are not reflected to the list which is added to this
    content type. If that is the case, I'd suggest you recreate content type.
    If the site content type works well in other two libraries, please create a new library and add this content type. If it works well, then move the list content to this new list.
    Regards,
    Rebecca Tu
    TechNet Community Support

  • List content type columns don't show new names after resource files were changed

    Hello,
    we ran into a problem, that we're not able to figure out at the moment.
    We have a site collection with site columns and site content types defined and created with
    features ant their XML files. All display names are retrieved from resource files. We do have
    several subsites, that have predefined lists also created from features and their corresponding
    XML files. They use inherited versions of these site content types as list content types with
    their columns inherited from the site columns.
    We had some changes within the resource files and never ran into a problem up to now.
    We changed the display names of some of these columns within the resource files. After
    these changes the site columns, site content types and list columns show the changes
    as planned. Unfortunately the columns of the list content types do not display the changes.
    They still show the old name. If you try to alter the old names manually the new name is
    shown within the form, but you're not able to save it and the list content type columns
    still have their old name afterwards.
    We checked our definition files and they seemed to be well.
    Any ideas?
    Regards,
    Markus
    List columns as defined within new the resource file:
    List content type columns, that do not show the changes from the new resource file:

    Hi,
    According to your post, my understanding is that you want to modify the site column name in the list.
    I try to reproduce the issue, however, everything works well.
    You can modify the DisplayName in the Element.xml file.
    Then after you redeploy the project, the site column name will be changed in the list setting page.
    In addition, please check whether you create the list correctly.
    For more information, you can refer to
    Walkthrough: Create a Site Column, Content Type, and List for SharePoint
    Thanks,
    Linda Li                
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Linda Li
    TechNet Community Support

  • How to retrieve the content type used in a document library (C# - Client Model).

    Hello,
    I need to know if it's possible to retrieve the content type used in a document library, so I can know the columns active and used in this document library. I am using the Client Model in C#.
    Thanks

    First, retrieve your document library as a List object. Then, use the
    List.ContentTypes property to iterate through all the content types assigned to the list.
    Blog:
    blog.beckybertram.com |
    RSS | @beckybertram |
    SharePoint 2010: Six-in-One

  • External Content Type Using SQL

    I’m trying to setup an external content type using just SharePoint designer. 
    I will need to be able to show other individual within the organization how to create these content types so getting it to work with just SharePoint designer is the goal. 
    No Programming involved please.
    Abbreviated Steps I have taken
    The account that we will use to connect to 2012 SQL server has been created and the correct permissions have been granted to the database.
    The secure store service account has been created and setup
    Go into SharePoint designer 2010 to create the external content type using
    Impersonated Custom Identity and inputting in the username and password that was setup in SQL server and added to the secure store credentials for the secure store service. I receive error cannot login with the provided credentials.
    I have searched the web trying to correct this issue and cannot find anything that will assist. 
    Everything either shows you to connect with windows identity (not an option) or breezes past this issue.

    To connect as an impersonated custom identity you have to:
    1. Be sure SQL login on SQL Server uses SQL authentication
    (not Windows one!)
    2. Create target application in Secure Store with:
      a. Target app type - "Group"
      b. Field types - Username and
    Password
    3. Don't forget to grant required permission to a new Traget Application.
    Here is a good guide (look at steps 4-8):
    http://lightningtools.com/bcs_meta_man/sharepoint-2010-secure-store-service-and-oracle/

  • Can I deploy a reusable workflow (2010 platform) with wsp package?

    I am working on a SharePoint 2013 on-premise farm. But it only support SP2010 workflow platform because workflow manager is not installed.
    In the development farm, I build a simple workflow with SPD2013. It works as expected. However I don't know how to deploy it to production environment. Our security policy forbid us directly connect production site with SPD or Visual Studio.
    I follow this article:
    http://blogs.msdn.com/b/sharepointdesigner/archive/2012/08/30/packaging-list-site-and-reusable-workflow-and-how-to-deploy-the-package.aspx
    I changed my workflow into a reusable workflow (because list workflow cannot be exported under 2010 platform). Export it into a wsp file. Then upload to another test site collection and activated the feature. I got no error but I cannot run the workflow.
    When I check with SPD, I found the workflow is existing on the site but it is not associate with any list.
    What should I do? Any alternative? Thanks.

    Few lines from same blog, please make sure these checks has been performed
    "You need to guarantee that the relative list urls (eg. ‘Lists/Vacation’) are the same. Even if you create a list with a given name and then change it to a different name, the list url will not change, this
    is because it is based on the original display name. As such, even though you packaged the workflow based on the list’s updated name, the workflow will still look for a list url based on the old name in the target site. Therefore, when you are recreating the
    lists in the target site, you must make sure that you initially give the lists the original name, and not the updated name. This way the list url will be preserved. After the list is created, you can change the list’s name to the updated one."
    Please 'propose as answer' if it helped you, also 'vote helpful' if you like this reply.

  • Application Error while activating the feature - for creating list content type, list definition and list instance

    Dear all,
    I am getting application error while enabling the feature. if any body can point out the issue - that will be helpful.
    content type
    <?xml version="1.0" encoding="utf-8"?>
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
    <Field ID="{4C1B0A21-FCE0-4CFE-8742-A250672AFE4F}" Type="Note" Name="CourseDesc" DisplayName="Course Description" Required="TRUE" Group="Training Site Columns"/>
    <!-- Parent ContentType: Item (0x01) -->
    <ContentType ID="0x0100d57ecc53fde34177b096abd0ec90a8f9"
    Name="TrainingCourses"
    Group="Training Content Types"
    Description="Defines a Course"
    Inherits="TRUE"
    Version="0">
    <FieldRefs>
    <FieldRef ID="{4C1B0A21-FCE0-4CFE-8742-A250672AFE4F}" Name="CourseDesc" DisplayName="Course Description" Required="TRUE"/>
    </FieldRefs>
    </ContentType>
    </Elements>
    List definition
    <?xml version="1.0" encoding="utf-8"?>
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
    <!-- Do not change the value of the Name attribute below. If it does not match the folder name of the List Definition project item, an error will occur when the project is run. -->
    <ListTemplate
    Name="TrainingCourses"
    Type="10100"
    BaseType="0"
    OnQuickLaunch="TRUE"
    SecurityBits="11"
    Sequence="410"
    DisplayName="TrainingCourses"
    Description="Training Courses List Definition"
    Image="/_layouts/images/itgen.png"/>
    </Elements>
    List instance
    <?xml version="1.0" encoding="utf-8"?>
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
    <ListInstance Title="TrainingCourses"
    OnQuickLaunch="TRUE"
    TemplateType="10100"
    Url="Lists/TrainingCourses"
    Description="Training Course List Instance">
    </ListInstance>
    </Elements>
    schema
    <?xml version="1.0" encoding="utf-8"?>
    <List xmlns:ows="Microsoft SharePoint" Title="TrainingCourses" FolderCreation="FALSE" Direction="$Resources:Direction;" Url="Lists/TrainingCourses-LD_TrainingCourses" BaseType="0" xmlns="http://schemas.microsoft.com/sharepoint/">
    <MetaData>
    <ContentTypes>
    <ContentType ID="0x0100d57ecc53fde34177b096abd0ec90a8f9" Name="TrainingCourses" Group="Training Content Types" Description="Defines a Course" Inherits="TRUE" Version="0">
    <FieldRefs>
    <FieldRef ID="{4C1B0A21-FCE0-4CFE-8742-A250672AFE4F}" Name="CourseDesc" DisplayName="Course Description" Required="TRUE" />
    </FieldRefs>
    </ContentType>
    </ContentTypes>
    <Fields>
    <Field ID="{4c1b0a21-fce0-4cfe-8742-a250672afe4f}" Type="Note" Name="CourseDesc" DisplayName="Course Description" Required="TRUE" Group="Training Site Columns" />
    </Fields>
    <Views>
    <View BaseViewID="0" Type="HTML" MobileView="TRUE" TabularView="FALSE">
    <Toolbar Type="Standard" />
    <XslLink Default="TRUE">main.xsl</XslLink>
    <RowLimit Paged="TRUE">30</RowLimit>
    <ViewFields>
    <FieldRef Name="LinkTitleNoMenu">
    </FieldRef>
    <FieldRef Name="CourseDesc">
    </FieldRef>
    </ViewFields>
    <Query>
    <OrderBy>
    <FieldRef Name="Modified" Ascending="FALSE">
    </FieldRef>
    </OrderBy>
    </Query>
    <ParameterBindings>
    <ParameterBinding Name="AddNewAnnouncement" Location="Resource(wss,addnewitem)" />
    <ParameterBinding Name="NoAnnouncements" Location="Resource(wss,noXinviewofY_LIST)" />
    <ParameterBinding Name="NoAnnouncementsHowTo" Location="Resource(wss,noXinviewofY_ONET_HOME)" />
    </ParameterBindings>
    </View>
    <View BaseViewID="1" Type="HTML" WebPartZoneID="Main" DisplayName="$Resources:core,objectiv_schema_mwsidcamlidC24;" DefaultView="TRUE" MobileView="TRUE" MobileDefaultView="TRUE" SetupPath="pages\viewpage.aspx" ImageUrl="/_layouts/images/generic.png" Url="AllItems.aspx">
    <Toolbar Type="Standard" />
    <XslLink Default="TRUE">main.xsl</XslLink>
    <RowLimit Paged="TRUE">30</RowLimit>
    <ViewFields>
    <FieldRef Name="Attachments">
    </FieldRef>
    <FieldRef Name="LinkTitle">
    </FieldRef>
    <FieldRef Name="CourseDesc">
    </FieldRef>
    </ViewFields>
    <Query>
    <OrderBy>
    <FieldRef Name="ID">
    </FieldRef>
    </OrderBy>
    </Query>
    <ParameterBindings>
    <ParameterBinding Name="NoAnnouncements" Location="Resource(wss,noXinviewofY_LIST)" />
    <ParameterBinding Name="NoAnnouncementsHowTo" Location="Resource(wss,noXinviewofY_DEFAULT)" />
    </ParameterBindings>
    </View>
    </Views>
    <Forms>
    <Form Type="DisplayForm" Url="DispForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" />
    <Form Type="EditForm" Url="EditForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" />
    <Form Type="NewForm" Url="NewForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" />
    </Forms>
    </MetaData>
    </List>
    I am applying the feature to SPWeb level.
    cheers
    Sathya

    redeployed a new solution; since I was getting this error. I would have done typo errors etc.
    https://naveengopisetty.wordpress.com/2011/09/10/error-occurred-in-deployment-step-activate-features-invalid-file-name-the-file-name-you-specified-could-not-be-used-it-may-be-the-name-of-an-existing-file-or-directory-or-you-may-not-have-pe/
    Cheers
    Sathya

  • Customising a SharePoint list content type form - "Manage multiple list items with this form"

    I have designed a form for a content type on an existing SharePoint list.  When I ran the initial wizard, I selected
    Manage multiple list items with this form which is great, exactly what I want.
    But, there are some columns in this content type that I do not want repeating and have them moved them outside of the Repeating Section but I am getting the below error.  I can't seem to find a way to create a new non-repeating group though.  Any
    advice on how to do this?

    *Bump*

  • Deleting sharepoint list content type Fields

    Hi
    Please tell me the code for deleting all the fields inside content type fields..This is my code i used,but its not deleting the fields.
     SPSite spsite = new SPSite("http://ghfjhhk18:8001");
                SPWeb web = spsite.OpenWeb();
                web.AllowUnsafeUpdates = true;
                SPList list = web.Lists["Test"];
                SPContentTypeCollection cts = list.ContentTypes;
                SPContentType ct = cts["Item"];
               // ct.FieldLinks.Delete("Expires");
                //ct.Update();
                SPFieldCollection contentTypeFieldCollection = ct.Fields;
                foreach (SPField spField in contentTypeFieldCollection)
                    if (ct.Fields.ContainsField(spField.Title))
                        //SPFieldLink fieldLink = new SPFieldLink(spField);
                        ct.FieldLinks.Delete(spField.Title);
                    //myContentType = null;
                ct.Update();
                web.AllowUnsafeUpdates = false;
            }but this code is not deleting the fields..
    pls help me as soon as possible.
    One friend told me to do for loop in reverse..but how can i accomplish that

    Hi,
    Please refer the below code snippet which may help you to fix your issue. If not please refer the below links also
    http://ptsharepoint2010.blogspot.in/2011/12/programmatically-remove-fields-from.html
    http://www.c-sharpcorner.com/uploadfile/54db21/delete-field-content-type-in-sharepoint-2010-programmaticall/
    using (SPWeb web = site.OpenWeb())
    SPList spList = web.Lists["<ListName>"];
    SPContentTypeCollection spCTS = spList.ContentTypes;
    SPContentType spCT = spCTS["YourContentType"];
    spCT.FieldLinks.Delete("YourField");
    spCT.Update();
    If its not helping you, please let us know
    Sekar - Our life is short, so help others to grow
    Whenever you see a reply and if you think is helpful, click "Vote As Helpful"! And whenever
    you see a reply being an answer to the question of the thread, click "Mark As Answer

  • List field vs. Content Type Field - Powershell

    Hello,
    We have a bunch of document libraries where we have a List Column that contains information.  We have recently added a content type to the libraries and would like to copy the information from the List Column to a field in the content type.
    How do I use powershell to refer to these fields?
    If I have the Document Library (List) as a variable $list then I assume that I refer to the field as $list.$column.  But how do I do the same for the document?   How do I iterate through each document in the library to accomplish the same thing
    with a for loop?
    Something like:
    $list = $web.GetList("My List Name")
    foreach ($document in $list)
    $document.Fields["Document Field"] = $list.Fields["List Field"]
    $document.update()
    Any help would be greatly appreciated,
    Matt

    your code should be similar to
    $web=Get-SPWeb http://your_site_url_here
    $list=$web.Lists["List_Name_here"]
    foreach($item in $list.Items)
    #your logic here
    Hope that helps|Amr Fouad|MCTS,MCPD sharePoint 2010

Maybe you are looking for