2

Is it possible to convert any .webpart file to a .dwp so that I would

  1. Export a .webpart file
  2. Convert it to .dwp file (add every property in dwp format)
  3. Import it back

1 Answer 1

3

Since .dwp web part file corresponds to SharePoint-based web parts and .webpart to ASP.NET web parts, web part file can not be converted without rebuilding web parts itself.

The difference between SharePoint-based and ASP.NET web parts

The set of features provided exclusively by Microsoft.SharePoint.WebPartPages.WebPart is as follows:

  • Cross page connections
  • Connections between Web Parts that are outside of a zone
  • Client-side connections (Web Part Page Services Component)
  • Data caching infrastructure, including the ability to cache to the database

Example: convert Content Editor web part file format (V2 -> V3)

An attempt to convert SharePoint-based web part file from version 2 (MSContentEditror.dwp):

<?xml version="1.0" encoding="utf-8"?>
<WebPart xmlns="http://schemas.microsoft.com/WebPart/v2">
    <Assembly>Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Assembly>
    <TypeName>Microsoft.SharePoint.WebPartPages.ContentEditorWebPart</TypeName>
    <Title>Content Editor</Title>
    <Description>Allows authors to enter rich text content.</Description>
    <PartImageLarge>/_layouts/images/mscontl.gif</PartImageLarge>
</WebPart>

to version 3 (MSContentEditror.webpart):

<?xml version="1.0" encoding="utf-8"?>
<webParts>
  <webPart xmlns="http://schemas.microsoft.com/WebPart/v3">
    <metaData>
      <type name="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c,Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
      <importErrorMessage>Cannot import this Web Part.</importErrorMessage>
    </metaData>
    <data>
      <properties>
        <property name="Title">Content Editor</property>
        <property name="Description">Allows authors to enter rich text content.</property>
        <property name="PartImageLarge">/_layouts/images/mscontl.gif</property>
      </properties>
    </data>
  </webPart>
</webParts>

will give an error during adding web part on page.

3
  • Could you elaborate a bit more... I think it is possible to create a web part and then use both .dwp and .webpart files to import it on page (dont remember if this applies to both SP based and ASP.NET based web parts).
    – thomius
    Commented Feb 26, 2014 at 10:53
  • 1
    The answer has been updated to reflect why it does not seem possible just to convert file format Commented Feb 26, 2014 at 12:25
  • Ok, I think this is fine. I also haven't gotten this to work with out-of-the-box web parts (although I think I've used both for self-created web parts some time ago).
    – thomius
    Commented Feb 26, 2014 at 13:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.