c# - Update a OneNote page, using the developer API -



c# - Update a OneNote page, using the developer API -

i tried update page in onenote microsoft reference : http://msdn.microsoft.com/en-us/library/office/jj680118.aspx

here's problem. when tried update page right id, throwed me error saying : exception hresult: 0x80042000.

here code :

static void updatepagecontent() { applicationclass onapplication = new applicationclass(); string strimportxml; strimportxml = @"<?xml version="+"1.0"+" encoding="+"utf-16"+"?>" + " <one:page xmlns:one="+"http://schemas.microsoft.com/office/onenote/12/2004/onenote\""+"" + "id=\"{5be09697-903a-45dd-88d4-8ad301a3d91f}{1}{b0}\">" + " <one:pagesettings rtl=\"false\" color=\"automatic\">" + " <one:pagesize>" + " <one:automatic/>" + " </one:pagesize>" + " <one:rulelines visible=\"false\"/>" + " </one:pagesettings>" + " <one:title style=\"font-family:calibri;" + " font-size:17.0pt\" lang=\"en-us\">" + " <one:oe alignment=\"left\">" + " <one:t>" + " <![cdata[my sample page]]>" + " </one:t>" + " </one:oe>" + " </one:title>" + " <one:outline >" + " <one:position x=\"120\" y=\"160\"/>" + " <one:size width=\"120\" height=\"15\"/>" + " <one:oechildren>" + " <one:oe alignment=\"left\">" + " <one:t>" + " <![cdata[sample text]]>" + " </one:t>" + " </one:oe>" + " </one:oechildren>" + " </one:outline>" + " </one:page>"; // update page content seek { onapplication.updatepagecontent(strimportxml, system.datetime.minvalue); } grab (comexception e) { console.writeline("error message : " + e.message); } }

i don't know how solve this.

there issues in strimportxml string, causes update fail.

adjust @"<?xml version="+"1.0"+" encoding="+"utf-16"+"?>" "<?xml version=\"" + "1.0" + "\" encoding=\"" + "utf-16" + "\"?>" add empty space before page id attribute ( + " " + "id... instead of + "" + "id) make sure page id found/ nowadays in onapplication hierarchy make sure reference com library matching namespace defined in one:page element (e.g. office 2013/ 15.0 object library has namespace)

c# xml onenote

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -