i trying to change document content type. I must use workflow, and the best way will by workflow create in sharepoint desingner. I know how do it programatical in visual studio
相关问题
- Sharepoint multiple connections to a web parts
- Trouble with OR in Sharepoint CAML
- List Microsoft Sharepoint Sites with Microsoft Gra
- How to use VBA or Powershell to export lists from
- redirect using itemreceiver sharepoint
相关文章
- How To Get The Value Of Header In CSV
- What is a nice, reliable short way to get the char
- carrierwave setting content_type incorrectly
- File Upload to SharePoint 2013 using REST API
- Passing file object to Web API from Javascript
- JAX-RS Jersey Read entity with Content-Type “*”
- How can I iterate recursively though a sharepoint
- SharePoint, VirtualPathProviders and Application R
I just changed the content type of a list item through a workflow in SharePoint Designer 2010. When I added Set item from current list and chose Content Type ID the dropdown allowed me to select from the different content types. I didn't loose any data probably because my content types use some of the same fields.
I'm pretty sure you can't, certainly not from a SP Designer workflow.
You have to remember that there is no way SharePoint can be sure that the two contenttypes (before and after) have the same sorts of columns, and even if they did, couldn't easily map values from the old contenttype to the new.
Since you noted you can program in Visual Studio, I checked your options with regard to the SharePoint object model. There's no method available on either an SPListItem or an SPFile with which to change the associated contenttype. So, as far as I know, you'd be reduced to reading the values from the old listitem and creating a new one (with the new contenttype association), using custom code.
I'm not sure if that's something I'd wanna do, besides the fact that you'd lose the Created and Modified information from the old listitem.
But yeah, that's your only option, I think...
I know this is an old question, but I figured this out:
You CAN do this using a SPD workflow (SPD 2007 or 2010). You can call the content type field in two ways:
In a workflow, use the "If [field] equals [value]" or the "Set [field] to [value]"
For the "If" statement, the field will be called "Content Type". The "Set" statement field will be called "Content Type ID". In either case you can assign the value based on available content types.
You do need to enable content types on the list or library settings. Here's an example workflow based on a custom list to record Accounts Payable entries:
List Column: Request Type (choice column with the choices of Reimbursement, Department Expense, Other)
List Content Types: Default, Accounts Payable, Accounts Receivable
When the workflow fires, it will only set the Content Type to Accounts Payable if the Request Type column is equal to Reimbursement.
Of course you can use SPD workflow to change content type of an item. Naturally, the library where the item resides must be configure to accept both types. Here's a link to an application that makes use of this: http://www.sharepoint911.com/blogs/laura/Lists/Posts/Post.aspx?List=daba3a3b-c338-41d8-bf52-cd897d000cf3&ID=43&Web=dbb90e85-b54c-49f4-8e97-6d8258116ca0