public void AttachFileToListItem
(
string siteUrl,
string webName,
string listName,
int itemId,
string fileName,
bool overwrite) { using (ClientContext clientContext = new ClientContext(siteUrl)) { FileStream fileStream = new FileStream(fileName, FileMode.Open); string attachmentPath = string.Format("/{0}/Lists/{1}/Attachments/{2}/{3}",
webName, listName, itemId, Path.GetFileName(fileName)); File.SaveBinaryDirect(clientContext, attachmentPath, fileStream, overwrite); } }
No comments:
Post a Comment
Thank you for Commenting Will reply soon ......