Changing the Modified Date of a List Item using the SharePoint Client Object Model (C#) with Contribute Permission

I have a small snippet of code that I use to update the Modified Date of a list item and it works great for users with Full Control permissions.  However, for users with just Contribute access to the site the code doesn't work.  Instead, SharePoint
just updates the Modified Date to now.
I did some testing, and narrowed down the specific permission level that allows updating of Modified dates and oddly enough, it's the "Manage Permissions" level.
Has anyone run into this issue? If so, how do I work around this and update the Modified date as a user with only Contribute access to a site/library?
Here's the code:
DateTime Test = new DateTime(2012, 5, 4);
ListItem li = list.GetItemById(itemID);
li["Modified"] = Test;
li.Update();
ct.ExecuteQuery();
Thanks,
Max

Hello,
As a workaround you can pass admin credential in your code because as per my knowledge contributor can't update default columns like: created by, modified by, modified, created.
ClientContext clientContext = newClientContext(siteUrl);
ClientContext.Credentials = newNetworkCredential(UserName, Password, Domain);
Hope it could help
Hemendra:Yesterday is just a memory,Tomorrow we may never see
Please remember to mark the replies as answers if they help and unmark them if they provide no help

Similar Messages

  • The remote server returned an error: (401) Unauthorized. while running client context using sharepoint client object model

    Hi,
    I have started using the client object model so that i do not have to go to sharepoint admins to perform some basic operations on remote server. While assigning list item level permission i am getting following error, could you please help. thanks.
    The remote server returned an error: (401) Unauthorized.
       at
    System.Net.HttpWebRequest.GetResponse()
       at
    Microsoft.SharePoint.Client.SPWebRequestExecutor.Execute()
       at
    Microsoft.SharePoint.Client.ClientContext.EnsureFormDigest()
       at
    Microsoft.SharePoint.Client.ClientContext.ExecuteQuery()
       at
    SetDowntimeItemPermission.SetPermission.Main(String[] args) in

    it seems your request was unauthenticated i'm not sure are you using a web application with FBA or desktop application my suggestion would be try to impersonate your request by passing network credentials (COM works on network credentials )
    NetworkCredential credentials = new NetworkCredential("username", "pwd", "domain");
    ClientContext context = new ClientContext("http://site-url");
    context.Credentials = credentials;
    Best Regards, Ashutosh | SharePoint World

  • Is there any way to have an ipad wifi 3G but not use the 3G (therefore avoiding the extra data plan costs) and just use the wifi?

    i am looking to buy an ipad 2 or the new ipad (preferably 32gb) but dont want to buy the 3G version as i have unlimited data usage in my mobile phone plan, i know the wifi only ipad is generally cheaper, but i was wondering if there was a way to buy the ipad with 3G capabilities but not use the 3G and avoid the cost of paying the extra unnecessary data plan? (I know this is a really weird question but i have the opportunity to buy a 3G ipad and was curious of the possibility? any help would be greatly appreciated. cheers

    Yes to your questions.
    You can download a complete iPad User Guide here: http://manuals.info.apple.com/en/ipad_user_guide.pdf
    If you want an iPad 2 32GB it will have to be a refurb model. The only new iPas 2 is 16GB.
    What are all the differences between the iPad 3rd Gen and the iPad 2? Is the iPad 2 worth the cost savings?
    http://everymac.com/systems/apple/ipad/ipad-faq/differences-between-ipad-3rd-gen -2012-ipad-2-2011.html
    What are all the differences between the iPad 3rd Gen models? Which should I buy?
    http://everymac.com/systems/apple/ipad/ipad-faq/differences-between-ipad-3rd-gen -early-2012-models.html
    Should I Buy a New iPad? Or an iPad 2?
    http://www.maclife.com/article/blogs/should_i_buy_new_ipad_or_ipad_2
    iPad 3 vs iPad 2 vs iPad 1- Feature comparisons with iOS 5
    http://ipadhelp.com/ipad-help/ipad-3-vs-ipad-2/
    iPad Q&A
    http://www.everymac.com/systems/apple/ipad/ipad-faq/differences-between-ipad-3rd -gen-early-2012-models.html
    A Few Questions (and Answers) About the New iPad
    http://pogue.blogs.nytimes.com/2012/03/15/a-few-questions-and-answers-about-the-   new-ipad/?ref=personaltechemail&nl=technology&emc=edit_ct_20120315
    New iPad: A Polishing of the Old
    http://www.nytimes.com/2012/03/15/technology/personaltech/the-new-ipad-is-much-t he-same-only-better.html?nl=technology&emc=edit_ct_20120315
    iPad 1, 2 and New Specifications
    http://www.everymac.com/systems/apple/ipad/index-ipad-specs.html
    16GB vs 32GB vs 64GB: Which new iPad storage capacity should you get?
    http://www.imore.com/2012/03/08/16gb-32gb-64gb-ipad-capacity/
    How much content will fit on my iPod or iPhone?
    http://support.apple.com/kb/HT1867
    If you think you may get an iPad 2:
    Refurbished iPad Prices
    http://store.apple.com/us/browse/home/specialdeals/ipad
    New 16GB iPad 2 Prices
    http://store.apple.com/us/browse/home/shop_ipad/family/ipad/select_ipad2
    When iOS 6 comes out in the fall, the iPad 3 will get Siri, but the iPad 2 won't.
     Cheers, Tom

  • I want to move the move my photoshop elements photo database from an old pc to a new pc without losing the modified dates and tags created, what is the best way to transfer the database with all the information about the photos

    an old pc to a new one. How to I transfer the database file to save dates that have been modified and tags that have been created

    See:
    Use Backup, Restore to move catalog | Organizer | Elements 6 or later

  • How to update list item using client object model without changing created/modified dates?

    Hello All,
    I want to update list item using the SharePoint Client Object
    Model without updating the created / modified date. Is it possible?
    Please help.
    Thanks.

    Using the SystemUpdate method should do the trick, according
    to its literature.
    Additionally, would something like this be of any use for you?  Taken from this
    Stack Exchange thread: -
    public static class SPListItemExtensions
    /// <summary>
    /// Provides ability to update list item without firing event receiver.
    /// </summary>
    /// <param name="item"></param>
    /// <param name="doNotFireEvents">Disables firing event receiver while updating item.</param>
    public static void Update(this SPListItem item, bool doNotFireEvents)
    SPItemEventReceiverHandling rh = new SPItemEventReceiverHandling();
    if (doNotFireEvents)
    try
    rh.DisableEventFiring();
    item.Update();
    finally
    rh.EnableEventFiring();
    else
    item.Update();
    /// <summary>
    /// Provides ability to update list item without firing event receiver.
    /// </summary>
    /// <param name="item"></param>
    /// <param name="incrementListItemVersion"></param>
    /// <param name="doNotFireEvents">Disables firing event receiver while updating item.</param>
    public static void SystemUpdate(this SPListItem item, bool incrementListItemVersion, bool doNotFireEvents)
    SPItemEventReceiverHandling rh = new SPItemEventReceiverHandling();
    if (doNotFireEvents)
    try
    rh.DisableEventFiring();
    item.SystemUpdate(incrementListItemVersion);
    finally
    rh.EnableEventFiring();
    else
    item.SystemUpdate(incrementListItemVersion);
    /// <summary>
    /// Provides ability to update list item without firing event receiver.
    /// </summary>
    /// <param name="item"></param>
    /// <param name="doNotFireEvents">Disables firing event receiver while updating item.</param>
    public static void SystemUpdate(this SPListItem item, bool doNotFireEvents)
    SPItemEventReceiverHandling rh = new SPItemEventReceiverHandling();
    if (doNotFireEvents)
    try
    rh.DisableEventFiring();
    item.SystemUpdate();
    finally
    rh.EnableEventFiring();
    else
    item.SystemUpdate();
    private class SPItemEventReceiverHandling : SPItemEventReceiver
    public SPItemEventReceiverHandling() { }
    new public void DisableEventFiring()
    base.DisableEventFiring();
    new public void EnableEventFiring()
    base.EnableEventFiring();
    Steven Andrews
    SharePoint Business Analyst: LiveNation Entertainment
    Blog: baron72.wordpress.com
    Twitter: Follow @backpackerd00d
    My Wiki Articles:
    CodePlex Corner Series
    Please remember to mark your question as "answered" if this solves (or helps) your problem.

  • IS BT CLOUD ALTERING THE "MODIFIED DATE" ON MY FIL...

    Hi
    I have BT Cloud 2GB Free running as both the downloaded "auto sync" software and also using the Chrome Browser Interface. I am on Windows XP.
    I only use Cloud to backup word / excel documents and family photos - basic things I just dont want to risk losing.
    I recently noticed something odd, when I sorted my BT Cloud View by "Date Modified" about twenty very 'old' files suddenly appeared at the top of the view - files I hadnt used in about 5 or 6 years.
    I definitely had not accessed these files yet when I went to look at them in "My Computer" and clicked on "Properties" I could see that the "Modified Date" had changed. In fact it seems that about a dozen or so files had been "modified" over night while my PC was left on in the next room. No other dates had changed on the files - it did not look like they had been "Re-Saved" I dont think since the original author had not changed.
    I started to monitor this and noticed about half a dozen files having their "modified dates" changed every day for the last three or four days. Its only Documents (Word Powerpoint Excel Text etc) that are being modified.
    And heres the thing - I ran a search on my computer of files modified in the last week and the only ones where I could not explain the change were files that are being backed up by "BT CLOUD" so its slightly possible there is a link. Of course this could be coincidence but I thought this might be a good initial avenue to explore since without BT Cloud's interface view of my files I would never have even noticed the problem in the first place.
    I'm pretty sure its not a Virus - I run my own Scanner every few days, its always up to date and I have Real Time Scanning enabled. I also ran a couple of online scans last night (Norton etc) and they found nothing.
    Its a recent development because I use Cloud every week and would have noticed before if things were changing.
    So a couple of questions really:
    Firstly has anyone else experienced this problem - I read somewhere that Some Virus Scanners can alter the Modified Date on your files unintentionally but the MS hotfix says this only happens in Vista/Win 7 I think and I am on XP. Could it be that when BT Cloud Scans the file it affects its modified date on your PC ?
    Secondly Could anyone else access my files in BT Cloud and modify them, and if so would that change to the 'online file' be represented back on my own PC when I "Synced" my backup
    Many thanks in advance for any help anyone can offer.

    I assume your raws are in DNG format? If xmp is in sidecar, it won't change raw file date.
    Anyway, saving xmp does not change any dates in Lightroom, so you should still be able to sort by edit time or capture time...
    But if you want control, you have to save manually instead of automatically.
    Two things that might help:
    1. Filter based on metadata status.
    2. robcole.com - DNGPreviewUpdater
    Rob

  • How to Create a Dynamic http address that opens the Explorer Window for a List Item When a Button Is Clicked--Currently Trying to Make this Work with Javascript

    I have created a button (via Content Editor) that uses JavaScript to open the Attachments folder of a list item in the Explorer Window in SharePoint 2010. The purpose is to have drag and drop functionality for each list item, having multiple attachments.
    The button works but opens the "Attachments" folder containing all of the other folders for each list item (one folder per item). It seems that when you add an attachment to a list item, SharePoint numbers the folder based on the item's ID. What
    I'm trying to do is take the JavaScript I have and have it run when a button is clicked in a custom form. When it runs, I'm trying to get it to open the "specific" folder for the list item. I have had success creating a hyperlink in the list that
    does this; however, the link WILL NOT work until I use the Content Editor created button that runs JavaScript, that prompts me to click OK to my profile certificate, and then opens the Attachment folder. After that occurs, I can use my hyperlinks without issue
    because I'm no longer prompted to click OK for my cert.
    So I'm trying to take the JavaScript I have and place it in a list item form (custom form) and have it run when a form button is clicked. The problem is I have very little knowledge of JavaScript (did I mention little?) and
    "don't know how to take the "http:" address I have in the script and append to it the list item ID, according to the record I have open."
    So that for any record I open, the script will grab the corresponding record ID (or list item ID) and append it.
    Here's the script I'm working with (which I didn't create but am grateful for):
    <style>
    .httpFolder {behavior:url(#default#httpFolder);}
    </style>
    <script text = "javascript">
       function fnOpenFolderView(){
       oDAV.navigateFrame("https://server/collection/site/subsite/Lists/Sublist/Attachments","_self");
    </script>
    <div id = "oDAV" class = "httpFolder"/>
    <input type = "button" value = "Open Attachment Folder" onclick = "fnOpenFolderView()"/>
    The above script, in the Content Editor, creates a button that opens the Attachments folder for the corresponding SharePoint list.
    JackSki123

    Hello Thriggle,
    Thank you for pointing that out. I appended your "GetUrlKeyValue" to the end and it worked. That said, I noticed it doesn't run as smoothly as when I simply click on the Content Editor button I created that resides on the SharePoint List
    ASPX page (not the form). The Content Editor button has the same code, minus the "GetUrlKeyValue". I click it; I get prompted to choose my cert; it opens right up.
    Now go to the ASPX Display form where I dump the code in a table cell. Button appears in cell; I click it; wait; wait; I get prompted for cert; it opens. Do I need some sort of "throttle" for the JavaScript? For instance, I thought before running
    JavaScript, you reference the library first. This code doesn't do that. I'm wondering if there's something more I need to make this run smoothly. Thank you both for getting me this far. 
    JackSki123

  • Assign Group permission to list item using client object model

    Hi,
       I am trying to add the list item and assign the permission to the list item by using SP 2010 client object model. The problem which i am facing that when i assign the group as a permission to the item, by automatically the limited access permission
    is added to the group. Please find the steps which i have followed,
    Step-1: Break role inheritance.
     foreach (var item in _listItemCollection)
                            if (item["FileLeafRef"].ToString().ToLower() == "xxx")
                                item.BreakRoleInheritance(true, false);
                                _clientContext.Load(item.RoleAssignments);
                                _folderItem = item;
    _clientContext.ExecuteQuery();
    Step 2: Remove all permissions of the list item.
       foreach (var assignment in _folderItem.RoleAssignments)
                        assignment.RoleDefinitionBindings.RemoveAll();
                        assignment.Update();
    _clientContext.ExecuteQuery();
    Step 3:
        Add Group as a permission to the list item.
      var role = _web.RoleDefinitions.GetByType(RoleType.Contributor);
                    var collRdb = new RoleDefinitionBindingCollection(_clientContext) { role };
                    Principal principal = _grp;
                    _folderItem.RoleAssignments.Add(principal, collRdb);
                    _folderItem.Update();
    _clientContext.ExecuteQuery();
        After adding the group successfully to the list item, i checked the group permission and it contains the value as "Contribute,Limited Access" to the site level and "Contribute" to the list item. Please guide me how to avoid to create Contribute,Limited
    Access role.
    Balaji

    Hi Dmitry,
      When I create the group and assign contribute permission, the group has the permission at the site level(to see the permission, click group and click view Group Permission).  I have added the list item and break the role inheritance permission
    and given the unique permission by providing group as a permission to the list item. After providing the permission, the group permission at the site level changed to "Contribute, Limited Access". I dont know how contribute permission changed to contribute,
    limited access.
    I found the workaround to fix this issue. I created the group and create the folder in the shared document library by using client object model. Due to facing some issue by providing the permission using client object model, i have created the event receiver
    to the document library and using server object model, i can able to assign the approprate group permission.
    Balaji

  • Trying to use Web LCID property to get the List name in client object Model

    Hi ,
    I am trying to change the "Personal Documents" list NoCrawl property under MySite using SharePoint Client Object Model. As we use  web.Lists.GetByTitle("Personal
    Documents"); method to get the list,but here problem is :for different language List name is in their language.So I tried to use LCID property of the WEB and
    have taken key-value pair (PersonalSiteOnet_List_PersonalDocuments) from the resource file for that language from 14 hive.
    Example:I have selected Spanish language .there are so many LCID for Spanish language but Microsoft has given only one language pack for Spanish.
    Then,My Question is that
    "All LCID for Spanish language are using same Spanish language pack dictionary file OR something else"
     

    Hi,
    According to your post, my understanding is that your requirement is getting list in different language.
    Here are two ways for your reference:
    1. We can use getById method instead, so that we can avoid the language issue.
    2. We can use an array to store the different list name in different language in you JavaScript code, then use the code snippet below to get the list:
    var userLcid =_spPageContextInfo.currentLanguage;
    var localizedStrings = {
    ListName: {
    _1033: "EnglishName",
    _3082: "SpanishName"
    var listName=localizedStrings.ListName["_" + userLcid];
    var list=web.Lists.getByTitle(listName);
    More information:
    http://msdn.microsoft.com/en-us/library/hh670609.aspx
    http://wellytonian.com/2012/11/language-packs-sharepoint-2010/
    Best Regards
    Dennis Guo
    TechNet Community Support

  • CAML Query to get specific item in folder based on dropdown value using Javascript client object model

    Hi,
    I am using the Javascript Client object model.
    I have a custom list and a custom document library.
    Custom list contains 2 columns - dlName , dlValue
    The document library contains 2 folders - "folder1" ,  "folder2" and contains some images.
    The image name starts with the "dlValue" available in the custom list
    I am using a visual webpart and using javascript client object model.
    I am trying to achieve the below functionality:
    1) Load a dropdown with the custom list.
    2) set the image based on the value in dropdown.
    I have achieved the first option, I have set the dropdown, but not sure how to query the folder and set the image.
    Below is the code i have used so far:
    //In Visual webpart
    <select id="ddlTest" >
    </select>
    <br/>
    <div id="PreviewLayer">
    <img id="imgPlaceHolder" runat="server" alt="Image" title="imgPlaceHolder" src=" " />
    </div>
    // In Javascript file
    function RenderHtmlOnSuccess() {
    var ddlTest = this.document.getElementById("ddlTest");
    ddlTest.options.length = 0;
    var enumerator = this.customListItems.getEnumerator();
    while (enumerator.moveNext()) {
    var currentItem = enumerator.get_current();
    var dropdownValue = currentItem.get_item("dlValue");
    ddlTest.options[ddlTest.options.length] = new Option(currentItem.get_item("dlName"), dropdownValue);
    setImage(dropdownValue); // Not sure how to query the folder and set the image based on value.
    // Also if dropdown value is changed, corresponding image should be shown
    How to query the folder and based on dropdown value, show the image? Also, how to handle the dropdown value change?
    Thanks

    Hi,
    Here are two links for your reference:
    Example of how to Get Files from a Folder using Ecmascript \ Javascript client object model in SharePoint 2010
    http://sharepointmantra.wordpress.com/2013/10/19/example-of-how-to-get-files-from-a-folder-using-ecmascript-javascript-client-object-model-in-sharepoint-2010/
    SP2010 JSOM Client Object Model: How to get all documents in libraries including all folders recursively
    http://sharepoint.stackexchange.com/questions/70185/sp2010-jsom-client-object-model-how-to-get-all-documents-in-libraries-including
    In SharePoint 2013, we can also use REST API to achieve it.
    http://msdn.microsoft.com/en-us/magazine/dn198245.aspx
    Thanks,
    Dennis Guo
    TechNet Community 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]
    Dennis Guo
    TechNet Community Support

  • Updation of List Settings through Client object model

    Hi all,Is there any way to update List settings through Client object model.
    I want to work with all the list settings programmaticaly using client object model.
    Is there any way??? 

    Hi,
         Handful operations you can do it with client object model as certain limitations are there, which are not in server object model. Sharepoint Client obejct model comes with 3 APIs .i.e .Net managed code, javascript api and silverlight
    object model . 
    For reference , i implemented test code to add list on the Quick launch.
             ClientContext clientContext = new ClientContext("Web FullUrl");
                Web web = clientContext.Web;
                List list = web.Lists.GetByTitle("Test");
                list.OnQuickLaunch = true;
                list.Update();
                clientContext.Load(list);
                clientContext.ExecuteQuery();
    Regards,
    Milan Chauhan
    LinkedIn
    |
    Twitter | Blog
    | Email

  • What is the easy way to update Managed Metadata field multi select values using client object model C#?

    The below mentioned code works sometimes and doesn't most of the time. What is the real best way to update multi select managed metadata fields?
    Microsoft.SharePoint.Client.File file = site.GetFileByServerRelativeUrl("/sites/myspsite/Documents/Presentation2.pptx");
    clientContext.Load(file);
    clientContext.ExecuteQuery();
    ListItem currentItem = file.ListItemAllFields;
    clientContext.Load(currentItem);
    clientContext.ExecuteQuery();
    currentItem["Country"] = "-1;#India|1d13cfe9-d6f4-4bd3-a6c7-4b46a81f2a96;#-1;#China|9c1dff73-82db-44b1-8d70-f4258dd24e47;#-1;#USA|b9295c0b-67d4-4dc5-99d4-e88af888de48";
    currentItem["Title"] = "Demo Doc";
    currentItem.Update();
    clientContext.ExecuteQuery();
    file.CheckIn("test check-in", CheckinType.MajorCheckIn);
    clientContext.ExecuteQuery();
    Anuradha!!

    Hi,
    Here are two blog for your reference:
    How to Work with Managed Metadata Columns by Using the SharePoint Client Object Model
    http://blogs.msdn.com/b/sharepointdev/archive/2011/11/18/how-to-work-with-managed-metadata-columns-by-using-the-sharepoint-client-object-model-kaushalendra-kumar.aspx
    SharePoint 2010 Code Tips – Setting a Managed Metadata Field with the Client Object Model
    http://sharepointfieldnotes.blogspot.com/2011/08/sharepoint-2010-code-tips-setting.html
    Best Regards
    Dennis Guo
    TechNet Community Support

  • *.eml Time Stamp - Select File in Windows Explorer Changes the Modified Date

    The Windows Live Mail *.eml files time stamp is getting changed to the current date when the file is selected in the Windows Explorer! I save backup copies of important E-mails to folders on the Hard Drive and then synchronize them with the same folders on other LAN Hard Drives for backup archives. When these E-mail files are selected or opened from the Windows Explorer in the Windows 7 OPS the Modified Date Time Stamp is changed to the current date automatically! This action creates a real problem when doing later synchronizations of all of the folders! The date will not be the original date of the E-mail and the original file will be over copied with the file with the newest date stamp. I stopped Indexing on the *.eml files and that stopped the time stamp change when overcopy synchronization, but if the file is selected during a viewing in Windows Explorer then the Time Stamp is updated to the current date again! A solution to this problem would be greatly appreciated if anybody knows of one. Thanks - - - Shorto

    The Date and Timestamp changing issue in Windows 7 has a two part fix!
    1. Disable the Indexing of the *.eml file type in the Indexing Options located by Clicking on "Control Panel" -  "Indexing Options" - Advanced Button - File Types Tab - scroll down to the .eml file type and uncheck the Box then click OK to finish, so
    that the Email type of files won't be Indexed.
    2. Delete the Registry Entry listed below, be sure to Export and Save the original Key so it could be Restored if something goes wrong!  \HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\PropertySystem\PropertyHandlers
     and Delete the .eml entry
    That should fix the problem with the changing Date/Timestamp of Email Files. For more information read CarlS's WindowsSeven Fourm thread where I also have more input:
     http://www.sevenforums.com/browsers-mail/35334-eml-files-timestamps-updated-constantly.html
    This should give you a better understanding on the problem and the Fix. - - - Shorto

  • Invalid data has been used to update the list item. The field you are trying to update may be read only.

    Trying to follow Serge Luca's Step by Step Tutorial. Creating Workflows for Windows Sharepoint Services and MOSS2007.  http://sergeluca.spaces.live.com/blog/cns!E8A06D5F2F585013!859.entry
    I have an onWorkflowActivated, followed by an ifElse condition and a log to history.
    In the IfElse, each branch has a code segment, that trys to update the status column in the list that the workflow is attached to.
    private void Authorize_ExecuteCode(object sender, EventArgs e)
    // tried serveral methods
    WorkflowProperties.Item["Status"] = "Automatically Approved";
    // tried all of the following (one at a time)
    item.update();
    WorkflowProperties.Item.Update();
    WorkflowProperties.Item.SystemUpdate();
    //tried this as well.
    Microsoft.SharePoint.SPListItem item = WorkflowProperties.Item;
    item["Status"] = "Automatically Approved";
    item.Update() ;
    On the update call I keep getting "Invalid data has been used to update the list item. The field you are trying to update may be read only."
    Could someone explain how to update "Status" column of the list item that the workflow is working on?
    Thank you very much.
    Bill
     

    Hi:
    you can do the following:
    add the following code to the workflow.xml file (under the MetaData section)
    Code Snippet
    <ExtendedStatusColumnValues>
    <StatusColumnValue>Branch1</StatusColumnValue>
    <StatusColumnValue>Branch2</StatusColumnValue>
    </ExtendedStatusColumnValues>
    then add 2 SetState activities one in each branch of the IfElse.
    for the code behind of setState1 (branch1) write the following code:
    Code Snippet
    state = Convert.ToInt32(SPWorkflowStatus.Max);
    for setState2 (branch2) write the following:
    Code Snippet
    state = Convert.ToInt32(SPWorkflowStatus.Max) + 1;
    where state is the variable assigned to the field State in the properties of the SetState(design lever), or instead of state u can use the following code:
    Code Snippet
    ((SetState)sender).State
    where sender is the object sent through the function parameter.
    hope this answered your question
    Best Regards

  • Invalid data has been used to update the list item. The field you are trying to update may be read only (Lookup Field).

    Hi.
    I am getting below error while adding value to look-up field.
    Invalid data has been used to update the list item. The field you are trying to update may be read only.
    I have tried many forums ans post but didn't come to know what's the root cause of issue. I am also posting Code for creating and adding lookup field.
    CAML to create lookup field (It works Fine)
    string lkproductNumber = "<Field Type='Lookup' DisplayName='Product Number' StaticName='ProductNumber' ReadOnly='FALSE' List='" + pNewMaster.Id + "' ShowField='Product_x0020_Number' />";
    Code to insert value to lookup field
    ClientContext client = new ClientContext(SiteUrl);
    client.Load(client.Web);
    client.Credentials = new NetworkCredential(this.UserName, this.Password, this.Domain);
    // Lookup Lists
    List pmList = client.Web.Lists.GetByTitle("Product_Master");
    //List Conatining Lookup Columns
    List piList = client.Web.Lists.GetByTitle("Product_Inventory");
    client.Load(piList);
    query.ViewXml = "<View/>";
    ListItemCollection collection = pmList.GetItems(query);
    client.Load(collection);
    client.ExecuteQuery();
    int prodid=0;
    foreach (ListItem item in collection)
    if (Convert.ToString(item["Product_x0020_Number"]) == ProductNumber)
    { prodid = Convert.ToInt32(item["ID"]); }
    ListItem piItem = piList.AddItem(new ListItemCreationInformation());
    piItem["Product_x0020_Number"] = new FieldLookupValue() { LookupId = prodid };
    piItem.Update();
    client.ExecuteQuery();
    Exception Detail
    Microsoft.SharePoint.Client.ServerException was caught
    Message=Invalid data has been used to update the list item. The field you are trying to update may be read only.
    Source=Microsoft.SharePoint.Client.Runtime
    ServerErrorCode=-2147352571
    ServerErrorTypeName=Microsoft.SharePoint.SPException
    ServerStackTrace=""
    StackTrace:
    at Microsoft.SharePoint.Client.ClientRequest.ProcessResponseStream(Stream responseStream)
    at Microsoft.SharePoint.Client.ClientRequest.ProcessResponse()
    at WebServiceProviders.ClientServices.NewProductInventory() in Z:\.............ClientServices.cs:line 889
    InnerException:
    Quick response is highly appreciated.
    Thanks
    Mehar

    Try some thing like below,
    your data value that needs to be update should be in this format "ID of the lookup";#"Title of the Lookup" 
    For example,
    listItem["Product_x0020_Number"]
    = "1;#iPhone";
    listItem["Product_x0020_Number"]
    = "2;#Mobile";
    Hope this helped you....

Maybe you are looking for

  • Publishing reports using BEx to the Portal

    We have a folder called Store_Data (under Public Documents in KM) that has 500 store folders for reports.  They are sorted by store number.  When publishing reports to those folders from BEx Broadcaster the folders are sorted by creation date which m

  • Installing and configuring ColdFusion 7.0.2 on Tiger (Intel or PCC)

    okay, this is an ugly one. my question is has anyone gotten ColdFusion 7.0.2 to run properly on Tiger? If so, how did you do it? Below is the tale of my experience: On a PCC - I downloaded the latest version on ColdFusion 7.0.2. installation was easy

  • Help with jars webstart and InputStream

    I am currently attempting to fix all the things that break the minute you attempt to use a jar under webstart. I have attempted to find an answer by searching the forums. I cannot determine how to overcome the following. I have third party jars for "

  • Disk size early 2009

    When the XServe 2009 was released, 2TB drives were new. Will the hardware support any of the new larger drives currently available?

  • Can BPC be integrated with ByDesign?

    Any issues regarding using BPC with ByDesign? Should the  ByDesign customer set up a BW cube for use with BPC NW? Should the customer down load data to MS SQL and then use BPC MS?