0
我通過SharePoint Web服務打開SharePoint文檔庫中的現有.docx文件,並試圖將新的模板附加到它們上。目前這部分代碼似乎沒有做任何事情。c#在DOCX中打開XML SDK更新附加模板
XNamespace w = "http://schemas.openxmlformats.org/wordprocessingml/2006/main";
OpenXmlPart documentSettingsPart = document.MainDocumentPart.DocumentSettingsPart;
XDocument documentSettingsXDoc = documentSettingsPart.GetXDocument();
documentSettingsPart.AddExternalRelationship("http://schemas.openxmlformats/org/officeDocument/2006/relationships/attachedTemplate", new Uri(_outLibraryTemplate, UriKind.Absolute));
using (XmlWriter xw = XmlWriter.Create(documentSettingsPart.GetStream(FileMode.Create, FileAccess.Write)))
documentSettingsXDoc.Save(xw);
有沒有人有任何想法,爲什麼這不工作 - 我需要做什麼才能讓這個去?