R – Error on AddWebPart (Sharepoint 2007)

servicesharepoint-2007web-parts

I am trying to use the AddWebPartToZone web service call within Sharepoint 2007 to add a webpart programmatically to a webpart page. We get a soap exception (Microsoft.Sharepoint.SoapServer.SoapServerException).

The webpart i am trying to add is the original version of the Chatterbox app found on codeplex. When i try and add a content editor webpart to the same page it works perfectly.

We can add the webpart manually (Chatterbox) to the webpart page and it works fine. We have checked and the web part is added appropriately to the safe controls list in the webconfig (as it should be). So the next step is to have a quick look in the logs. The messages we get are:

Monitorable Usage: Security - Web Services: AddWebPart

Monitorable Error importing WebPart. Assembly Microsoft.SharePoint.SampleParts.ChatterBox, Version=12.0.0.0, Culture=neutral, PublicKeyToken=48e046c834625a88, TypeName. Microsoft.SharePoint.SampleParts.ChatterBox  

I've tried amending the webpart XML we use on the webservice call and we get the same error message everytime. Now this looks like a permissions problem with the webpart but seeing as we have added it correctly to the safecontrols listing in the webconfig i can't see what else i can do?

Here is the webpart XML that we used:

<?xml version="1.0" encoding="utf-16"?>
    <WebPart xmlns:xsd="http://schemas.microsoft.com/WebPart/v3" xmlns:xsi="http://microsoft.com/sharepoint/webpartpages" xmlns="http://schemas.microsoft.com/WebPart/v2">
         <IsIncluded>true</IsIncluded>
         <ZoneID>Full Page</ZoneID>
         <PartOrder>1</PartOrder>
         <FrameState>Normal</FrameState>
         <Height />
         <Width />
         <AllowClose>True</AllowClose>
         <AllowRemove>true</AllowRemove>
         <AllowZoneChange>true</AllowZoneChange>
         <AllowMinimize>false</AllowMinimize>
         <IsVisible>true</IsVisible>
         <NumComments>10</NumComments>
         <UpdateInterval>5</UpdateInterval>
         <AllowConnect>True</AllowConnect>
         <ChromeType>Default</ChromeType>
         <TitleIconImageUrl />
         <Description />
         <Hidden>False</Hidden>
         <BackingListName>Potato</BackingListName>
         <UserName />
         <AllowEdit>True</AllowEdit>
         <DetailLink />
         <HelpLink />
         <Title>ChatterBox 101</Title>
         <Dir>Default</Dir>
         <PartImageSmall />
         <MissingAssembly />
         <PartImageLarge>/_layouts/images/mscontl.gif</PartImageLarge>
         <IsIncludedFilter />
         <Assembly>ChatterBox, Version=12.0.0.0, Culture=neutral, PublicKeyToken=48e046c834625a88</Assembly>
         <TypeName>Microsoft.SharePoint.SampleParts.ChatterBox</TypeName>
         <ChromeState>Normal</ChromeState>
         <HelpMode>Navigate</HelpMode>
      </WebPart>

We have a sharepoint 2007 (MOSS) box running on Win 2003. Any help would be really appreciated as this is slowly but surely doing my head in!

thanks,

Kev

Best Answer

Does the user the webservice is called under (NetworkCredentials) have the permission to add the webpart to that particular page?

Related Topic