簡體   English   中英

更改ContentType-VS2008中的SharePoint工作流

[英]Change ContentType - SharePoint Workflow in VS2008

我需要在Sharepoint工作流程中更改ContentType。 如果我設置以下內容,這會改變嗎? 如果沒有的話。 如果我當前將ContentType 1用於列表,並且想要切換到使用ContentType 2,則需要什么代碼才能實現此目的?

SPListItem currentItem = workflowProperties.Item;
SPContentType myCType = workflowProperties.List.ContentTypes["ContentType 2"];

        currentItem["ContentTypeId"] = myCType.Id;
        currentItem.Update();   

我認為這會奏效,但不確定。

謝謝,JJ

在我看來很好。 最后,我將調用currentItem.SystemUpdate() ,因為這不會影響“修改日期”和“修改依據”字段。 如果您僅調用Update ,它將顯示由“ Sharepoint \\ system”修改的項目

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM