DataFactoryService - Save | Episerver Developer Community

DataFactoryService - Save

Member since: 2006
 

I have some problems with the DataFactoryService and Saving.

I have this code:

var _service = new DataFactoryService(); 
_service.Url = Url;
_service.Credentials = new NetworkCredential(Username, Password, Domain);
_service.PreAuthenticate = true;
var pingResult = _service.Ping();
//ping result is "true"
var page = _service.GetDefaultPageData(new PageReference(){ID = ParentPageID}, PageTypeID);
//this results in a RawPage with a RawProperty-array (as expected)
//now set pageName for (int i = 0; i < page.Property.Length; i++)
{
if(page.Property[i].Name == "PageName")
{
page.Property[i].Value = "This is a test";
page.Property[i].IsNull = false;
page.Property[i].IsModified = true;
}
}
//Save page
var pageref = _service.Save(page, SaveAction);

This results in SoapException: Server was unable to process request. ---> The PageReference is read-only.

Any ideas?

 

#29767 May 13, 2009 8:09
  • Member since: 2006
     

    I found a solution. the rawproperty named PageLink must have a value (ie. "0") to enable saving.

     

    ex: 

    for (int i = 0; i < page.Property.Length; i++)
    {
    if(page.Property[i].Name == "PageLink")
    {
    page.Property[i].Value = "0";
    page.Property[i].IsNull = false;
    page.Property[i].IsModified = true;
    }
    }
     

     

    #29776 May 13, 2009 13:02
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
Please login to post a reply