Fred Net
Guest
|
Posted:
Mon Nov 07, 2005 9:51 am Post subject:
PageViewerWebPart not safe ? |
|
|
Hi all !
i've a problem using a pageviewerwebpart included in a template...
here's the thing : i've created a template (manually, onet.xml) , and in
this template, i've defined a default pageviewerwebpart. when i try to modify
the ContentLink property from the created site, everything's ok.
but i would like to modify this property from a webservice, and when i try
to get the webparts of the site, i can only get an ErrorWebPart, and it tells
me that the webparts are not safe.
Here's the definition of the web part in Onet.xml :
<AllUsersWebPart WebPartZoneID="Left" WebPartOrder="1">
<![CDATA[
<WebPart xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://schemas.microsoft.com/WebPart/v2">
<Title>Traitement d'un dossier</Title>
<FrameType>Default</FrameType>
<Description></Description>
<IsIncluded>true</IsIncluded>
<ZoneID>Left</ZoneID>
<PartOrder>1</PartOrder>
<FrameState>Normal</FrameState>
<Height>768px</Height>
<Width>1024px</Width>
<AllowRemove>false</AllowRemove>
<AllowZoneChange>false</AllowZoneChange>
<AllowMinimize>false</AllowMinimize>
<IsVisible>true</IsVisible>
<DetailLink />
<HelpLink />
<Dir>Default</Dir>
<PartImageSmall />
<MissingAssembly />
<PartImageLarge>/_layouts/images/mscntvwl.gif</PartImageLarge>
<IsIncludedFilter />
<Assembly>Microsoft.SharePoint, Version=11.0.0.0, Culture=neutral,
<ublicKeyToken=71e9bce111e9429c</Assembly>
<TypeName>Microsoft.SharePoint.WebPartPages.PageViewerWebPart</TypeName>
<ContentLink
xmlns="http://schemas.microsoft.com/WebPart/v2/PageViewer">http://www.google.fr</ContentLink>
<SourceType
xmlns="http://schemas.microsoft.com/WebPart/v2/PageViewer">URL</SourceType>
</WebPart>
]]>
</AllUsersWebPart>
Here's the code trying to update the web part (webservice):
SPWebPartCollection wpColl =
newSite.GetWebPartCollection("default.aspx",Microsoft.SharePoint.WebPartPages.Storage.Shared);
foreach (Microsoft.SharePoint.WebPartPages.WebPart wp in wpColl)
{
if (wp.GetType().ToString() ==
"Microsoft.SharePoint.WebPartPages.PageViewerWebPart")
{
((Microsoft.SharePoint.WebPartPages.PageViewerWebPart)wp).ContentLink =
newContentLink;
break;
}
}
newSite.Update();
and finally the web.config in inetpub/wwwroot :
<SafeControl Assembly="Microsoft.SharePoint, Version=11.0.0.0,
Culture=neutral, PublicKeyToken=71e9bce111e9429c"
Namespace="Microsoft.SharePoint.WebPartPages" TypeName="*" Safe="True" />
Did i miss something ?
Thanks a lot,
Fred |
|