0

my code is

 public static void AddNew(string title,string AddedDate, string Discription, string AddedByLoginName)
    {
        using (SPSite sps1 = new SPSite(SPContext.Current.Web.Url))
        {
            using (SPWeb spw1 = sps1.OpenWeb())
            {

                SPList std = spw1.Lists["WorkFlowTaskHistory"];
                SPListItem NewRecord = std.AddItem();

                NewRecord["Task"] = new SPFieldLookupValue (title);
                NewRecord["AddedDate"] = AddedDate;
                NewRecord["Discription"] = Discription;
                NewRecord["AddedByLoginName"] = AddedByLoginName;
                NewRecord.Update();
            }

        }

    }

but no add new record

1 Answer 1

1

I think you should pass the ID of the look up item to the SPFieldLooupValue. Please take a look at this question.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.