locked
Update with null value RRS feed

  • Question

  • Hi all,

    I have a custom attribute (lookup type). Now I want to update this attribute with null value. I know how to update with some value. I have used the following code to update with some value.
                   
                         DynamicEntity tsd = new DynamicEntity();
                          tsd.Name = "new_timesheetdetail";

                         LookupProperty dep = new LookupProperty();
                        dep.Name = "new_departmentid";
                        dep.Value = new Lookup();
                        dep.Value.Value = new Guid(<"guid">);
                        tsd.Properties.Add(dep);

    How can i update with null value. Very urgent for me

    Regards,
    GF
    Thursday, July 30, 2009 1:50 PM

Answers

All replies

  • Lookup p = new Lookup();
    p.IsNullSpecified = true;
    p.IsNull = true;

    Check this link: http://msdn.microsoft.com/en-us/library/cc151060.aspx

    Hope this helps;

    Thursday, July 30, 2009 1:57 PM
  • Hi,

    I have used lookupproperty for update a field with some value. Can i update like that using null value?.

    Thursday, July 30, 2009 1:59 PM
  • DynamicEntity tsd = new DynamicEntity();
                          tsd.Name = "new_timesheetdetail";

                         LookupProperty dep = new LookupProperty();
                        dep.Name = "new_departmentid";
                        dep.Value = new Lookup();
                        dep.Value.IsNullSpecified = true;
                        dep.Value.ISNull = true;
                        tsd.Properties.Add(dep);

    Then do your update
    Thursday, July 30, 2009 2:04 PM