0

I'm trying to deploy a custom web part to SharePoint 2013 On-Premises. I have created the web part (simple web part just an asp:label on it for testing). I also created an ASPX page (without code behind) which is deployed with a module. I can add the web part to the page from SharePoint -> Edit page -> add web part.

However I want to do this from my module elements file. If I do it, I got import error.

This is my aspx page main content placeholder:

<WebPartPages:WebPartZone runat="server" FrameType="TitleBarOnly" ID="Top" Title="loc:Top" />

And this is my module's elements.xml:

    <?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Module Name="PagesModule" Url="Lists/Pages" List="101">
    <File Path="PagesModule\CustomerFormPage.aspx" Url="CustomerFormPage.aspx" Type="GhostableInLibrary" ReplaceContent="TRUE">
      <AllUsersWebPart WebPartZoneID="Top" WebPartOrder="0">
        <![CDATA[
        <webParts>
  <webPart xmlns="http://schemas.microsoft.com/WebPart/v3">
    <metaData>
      <type name="CustomerForm.WebParts.CustomerDataWebPart.CustomerDataWebPart, $SharePoint.Project.AssemblyFullName$" />
      <importErrorMessage>Cannot import this Web Part.</importErrorMessage>
    </metaData>
    <data>
      <properties>
        <property name="Title" type="string">Customer</property>
        <property name="Description" type="string">Customer List WebPart</property>
      </properties>
    </data>
  </webPart>
</webParts>
        ]]>
      </AllUsersWebPart>
    </File>
  </Module>
</Elements>

Any idea what I am doing wrong?

Thanks in advance!

1 Answer 1

0

Do you have this code from the MSDN page?

The type name is not correct. $SharePoint.Project.AssemblyFullName$ is only a token.

You must replace it with the display name (strong name) of the containing project’s output assembly.

After it will look like this:

Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c

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.