views:

141

answers:

1

Dear all,

We are running one MOSS application as below:- 1. user use InfoPath request form to trigger workflow attached to SharePoint document library 2. all sub-sequent tasks are performed by users by InfoPath task form within SharePoint site through "Workflow Task" list (open, checkout, approve or reject) till the task completed. 3. all request form submitted could be viewed as xml file in the document library through "Explorer View"

My quesiton is why I cannot update the item located in the document library, basically open the SPListItem:-

        SPSite thisSite = new SPSite("http://server")
        {
            SPWeb thisWeb = thisSite.OpenWeb("/web")
            {
                thisSite.AllowUnsafeUpdates = true;
                thisWeb.AllowUnsafeUpdates = true;

                SPDocumentLibrary library = (SPDocumentLibrary)thisWeb.Lists["DocLib"];
                foreach (SPListItem item in library.Items)
                {
                    SPFile file = item.File;

I tried almost all ways I could find:-

  1. item["Customer Name"] = "123456";

    item.Update(); // or item.SystemUpdate();

  2. file.Item["Customer Name"] = "123456";

    file.Update();

After each update, the value resumed when reopen or visit through the same code lines! but when I view item properties, the "Last modified" is changed Last modified at 6/8/2010 12:27 AM by Administrator

This do drive me cray, any help, please.

Thanks & best regards, Leon

A: 

When you publish your form to a list, it asks you to choose the fields to be shown on that list. As you choose the item you want to update, click "Modify". Check the checkbox at the bottom saying "Allow user to edit data in this field by using a datasheet or property page". This works for me.

MegaHerz

related questions