I have the following code which creates an item in the library I want:
string newPageXml = String.Format(@"<Batch OnError='Continue'>
<Method ID='1' Cmd='New'>
<Field Name='ID'>New</Field>
<Field Name='Title'>{0}</Field>
<Field Name='PublishingPageContent'>{1}</Field>
<Field Name='LinkFilenameNoMenu'>{2}</Field>
</Method>
</Batch>", "test.aspx",
Microsoft.SharePoint.Utilities.SPEncode.HtmlEncode(newPageContent),
"test.aspx");
XmlDocument xdPage = new XmlDocument();
xdPage.LoadXml(newPageXml);
newItem = xdPage.DocumentElement;
createdItem = ceoList.UpdateListItems("Pages", newItem);
But when the item is created it gets the ID for that item as the file name. So if the ID is 37 then the Name will be 37_
.
I've tried DisplayName
, LinkFilename
, Name
and a few other values but the ID always shows up at the name. What do I need to put in here to specify the file name?
If I can't use the list service, how can I use any of the web services to create a new item in the Pages library?