in

Dot Net Mafia

Group site for developer blogs dealing with (usually) .NET, SharePoint, Office 365, Mobile Development, and other Microsoft products, as well as some discussion of general programming related concepts.

This Blog

Syndication

Archives

Corey Roth [MVP]

A SharePoint MVP bringing you the latest time saving tips for SharePoint 2013, Office 365 / SharePoint Online and Visual Studio 2013.

Quick Tip: Deploying a Data Connections Library using a Feature

If you’re like me at all, you like to see compete examples of how to do things.  Yes, I can usually read something and apply what I already know, but sometimes, it is nice to see a fully working example of something, before you try something on your own.  Today’s example is how to deploy a data connections library using a feature.  I already posted how to deploy a .UDCX file to a data connection library so I thought this post would go well with it.  Our example starts with a standard feature.xml file.

<Feature xmlns="http://schemas.microsoft.com/sharepoint/"

        Id="{EF18A3A1-8D0D-40a9-8BEF-B23ADE36889D}"

        Scope="Site"

        Hidden="False"

        Title="My Data Connection Library"

        Description="This deploys a data connection library">

  <ElementManifests>

    <ElementManifest Location="Elements.xml" />

  </ElementManifests>

</Feature>

Now we need to build our elements.xml file.  There are two things we need to know to deploy a SharePoint list in this case.  The list template id and the feature that the deployed the list template. The first thing we need to know is the List Template Type for the data connections library.  We can figure that out by looking at the type attribute in the List element of the SDK.  Looking at that, we determine the List Template Type is 130. 

We now need to figure out the feature id.  There is a number of ways to do this (and maybe it is even documented somewhere), but I went with a more brute force approach.  I knew that the Records Center site template provisioned a data connection library, so I went to the SiteTemplates folder in the 12 hive and found the SPSREPORTCENTER folder.  Looking at the onet.xml file inside, I found the line I needed.

<List Title="$Resources:spscore,ReportCenterOnet_DataConnectionsListInstanceName" FeatureId="00BFEA71-DBD7-4F72-B8CB-DA7AC0440130" Description="$Resources:spscore,ReportCenterOnet_DataConnectionsListInstanceDescription" Url="Data Connections" Type="130" />

There is the FeatureId and the Type again.  Note the FeatureId of 00BFEA71-DBD7-4F72-B8CB-DA7AC0440130.  For some reason, they never use brackets with the GUID on the Id here.  Not sure if that is required or not.  We can pretty much use this line in our elements file, but we do need to make some changes, since elements.xml needs a ListInstance element instead of a List element.  Here is what our ListInstance element looks like.

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">

  <ListInstance FeatureId="00BFEA71-DBD7-4F72-B8CB-DA7AC0440130" Id="{7C6924D1-5704-4a6f-9C6C-04902A312252}" TemplateType="130" DocumentTemplate="130" Title="Data Connections" Url="DataConnections" OnQuickLaunch="FALSE" Description="My Data Connection Library." />

</Elements>

As you can see it’s pretty similar.  Be sure and give it a unique Id.  You can customize the Url to your liking.  One thing I will point out is that you should not set RootWebOnly to true on this list.  If you do, you will get an Object Reference not found error and the list will not deploy.  Copy your feature files out to your 12 hive.  Then install and activate your feature.  You should have a data connections library at the URL you specify.  I will point out that the library won’t show up in the Lists on your site, nor will there be any navigation to it, but it will be there.  I hope this quick tip today helps you.

Comments

No Comments

Leave a Comment

(required)  
(optional)
(required)  
Add

About CoreyRoth

Corey Roth is an independent SharePoint consultant specializing in ECM, Apps, and Search.
2015 dotnetmafia.
Powered by Community Server (Non-Commercial Edition), by Telligent Systems