me pareció que la parte del mensaje delax que actualiza nuevos atributos de archivo/columnas no lo hará trabajo, aquí es otra versión que incluso wroks para una biblioteca infopath personalizada con el campo promovido:
public string AddNewForm(string WebUrl, string NewTitle)
{
string strMsg = "";
if (string.IsNullOrEmpty(WebUrl))
return EmptyProcURL;
try
{
// Starting with ClientContext, the constructor requires a URL to the server running SharePoint.
using (ClientContext client = new ClientContext(WebUrl))
{
//client.Credentials = System.Net.CredentialCache.DefaultCredentials;
// Assume that the web site has a library named "FormLibrary".
var formLib = client.Web.Lists.GetByTitle("FormLibrary");
client.Load(formLib.RootFolder);
client.ExecuteQuery();
// FormTemplate path, The path should be on the local machine/server !
string fileName = @"D:\Projects\FormTemplate.xml";
var fileUrl = "";
//Craete FormTemplate and save in the library.
using (var fs = new FileStream(fileName, FileMode.Open))
{
var fi = new FileInfo("newForm.xml");
fileUrl = String.Format("{0}/{1}", formLib.RootFolder.ServerRelativeUrl, fi.Name);
Microsoft.SharePoint.Client.File.SaveBinaryDirect(client, fileUrl, fs, true);
}
// Get library columns collection.
var libFields = formLib.Fields;
client.Load(libFields);
client.ExecuteQuery();
Microsoft.SharePoint.Client.File newFile = client.Web.GetFileByServerRelativeUrl(fileUrl);
ListItem item = newFile.ListItemAllFields;
// Here the index of Title column is 9, you may use this format to update any column (even promoted fields).
// To find the index of interested column you should inspect libFields at debug mode, look in the libFields.Fields collection to find the index!
item[libFields[9].StaticName] = NewTitle ;
item.Update();
client.ExecuteQuery();
}
}
catch (Exception ex)
{
strMsg = ex.Message;
}
return strMsg;
}
está preguntando por el modelo de JavaScript del lado cliente o el modo normal del cliente l? –
^Dijo que está usando .NET (C#) CSOM. – BrainSlugs83