This project has moved and is read-only. For the latest updates, please go here.

sample documentation for AddWebPart - WebPartPages

Nov 4, 2010 at 8:25 PM

Hi Marc,

Working on a few SPServices projects...great tool - thank you!

Here is a note for the documentation on this page

The "str" variable below is the full XML text of a content editor web part encoded using this tool:

    var str = "<?xml version="1.0" encoding="utf-16"?><WebPart xmlns:xsd="" xmlns:xsi="" xmlns=""><Title>Custom Part</Title><FrameType>Default</FrameType><Description>Use for formatted text, tables, and images.</Description><IsIncluded>true</IsIncluded><ZoneID>Left</ZoneID> <PartOrder>6</PartOrder><FrameState>Normal</FrameState><Height /><Width /> <AllowRemove>true</AllowRemove><AllowZoneChange>true</AllowZoneChange><AllowMinimize>true</AllowMinimize><IsVisible>true</IsVisible><DetailLink /><HelpLink /><Dir>Default</Dir><PartImageSmall /><MissingAssembly /><PartImageLarge>/_layouts/images/mscontl.gif</PartImageLarge><IsIncludedFilter /><Assembly>Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Assembly><TypeName>Microsoft.SharePoint.WebPartPages.ContentEditorWebPart</TypeName> <ContentLink xmlns="" /><Content xmlns=""><![CDATA[<P>" + new Date() + "</P>]]></Content> <PartStorage xmlns="" /></WebPart>";

	operation: "AddWebPart",
        webPartXml: str,
	pageUrl: "http://.../sandbox1/default.aspx",
	storage: "Shared",
	async: true,
	completefunc: function (xData, Status) {
          alert("Status: " + Status + " xData: " + xData.responseText);

Enjoy, hopefully this helps someone.



Nov 7, 2010 at 8:42 PM


Thanks again for the info! I'll add this into the docs.