var list = Context.Web.Lists.GetById(listId);
Context.Load(list);
Context.ExecuteQuery();
var item = list.AddItem(new ListItemCreationInformation());
item["Title"] = "New Item with attachment";
item.Update()
context.ExecuteQuery();
var attInfo = new AttachmentCreationInformation();
attInfo.FileName = "Attachment name";
attInfo.ContentStream = new MemoryStream(attachmentData);
var att = item.AttachmentFiles.Add(attInfo);
Context.Load(att);
Context.ExecuteQuery();
No comments:
Post a Comment