in

Dot Net Mafia

Group site for developer blogs dealing with (usually) .NET, SharePoint 2013, SharePoint 2010, Office 365, SharePoint Online, 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.

October 2009 - Posts

  • New ECM Features in SharePoint 2010

    MOSS 2007 was a very capable ECM product but there were definitely some things in it that required coding to accomplish.  There are five specific areas that are new or that have been improved that are worth mentioning for the world of Enterprise Content Management.

    Enterprise Content Types

    Enterprise Content Types (or ECTs) solve the problem of having to keep content types synchronized across site collections.  Typically, the issue in the past is that you create a content type in one collection and then you also have to updates those content types on all of your other site collections.  The power of the ECT is that it allows you to define one site collection as the hub and then the Managed Metadata Service looks at the source site collection and periodically updates all other site collections with any changes.

    Document Id Service

    Another ECM challenge is keeping track of documents that have gotten moved.  The Document Id Service helps with this by generating a unique identifier for every document uploaded.  It then stores this URL as metadata on your document and then creates a link passing the id to _layouts/docidredir.aspx.

    Managed Metadata (Term Store)

    This is a great new feature for ECM and I am afraid my description of it won’t be able to do it justice.  The way it works is that there is a new Managed Metadata column that you can add to your content types.  There is a place called the term store that allows you to create a hierarchy of terms in something called a term set.  This allows you to make relations to things.  For example, you could have continents, relate to countries, relate to states, relate to cities.  You can have the user specify a value by typing in the field and it searches as you type to find a matching term.  The cool part is that this applies to search, so if you search for the state of Washington, you will get documents that were tagged with a value of Redmond.  You can also create synonyms for terms for example you could have OKC resolve to Oklahoma City.  This is a really powerful new feature that will allow users to make better choices when classifying documents which in turn leads to better search results.  There really is a lot more to this, I’ll provide more details on it as I collect more information.

    In Place Records Management

    I know a handful of people that would say Records Management in MOSS 2007 was pretty much unusable.  I think SharePoint 2010 will change their minds.  The main issues were that you had to ship documents to an external library to manage them and the interface for applying holds was not very user friendly.  Activating the In Place Records Management feature will add a new button, Declare as Record, to the ribbon of document libraries.  Clicking this marks the item as a record and I believe puts it in a readonly state.  To go along with this, you can activate the Hold and eDiscovery feature which gives you a much nicer way to create and apply holds to records.  All of this together gives you the ability to apply holds to documents without ever having to ship them off any where (although you can still send them to an external records center).  You can also now schedule a job to move records to the record center on a regular basis.  I’ll also point out that there is a new Compliance button on the view properties page of a document.  This button allows you view holds, expiration, record status, and auditing.  This should make working with records much easier in the future.

    Document Sets

    SharePoint also now gives you the capability to group documents together in sets that can be worked with as one logical unit.  Effectively you create custom document content types and then create a document set content type.  The document set has a settings page which allows you to specific which child content types to include  It let;s you specify default documents to create when a new document set is created and gives you the capability of synchronizing metadata on shared site columns among the document set and child documents.  When you view the document set in a document library, it kind of opens like a folder but displays a page (which can be customized) showing metadata and each child document.  It also provides the ability to download the whole set as a zip file.  It’s interesting concept and may provide to be quite useful for some types of document collections.

    There are some exciting new features in SharePoint 2010 for ECM.  I think the Managed Metadata and the In Place Records Management will be highly useful myself.  There is obviously more to ECM than what I covered, but I hope these highlights are a good start in learning about the new features.

  • What’s new in SharePoint development in Visual Studio 2010

    As you have already probably heard, a bunch of things have been added to Visual Studio to make the development effort less painful.  After working with the new version for a little while, I have got to say it will definitely change the way you think about SharePoint development.  Things like deployment and debugging that you used to waste tons of time on are simply a non-issue now.  Believe it or not, you now truly can set a breakpoint in a web part and hit Ctrl+F5 and start debugging your code (assuming you put the web part on a page of course)

    Before we start, the first thing you need to know is that SharePoint 2010 is built with .NET 3.5 SP1 and not .NET 4.0.  All of the project types I have worked with were based on 3.5 although I have no reason to think they wouldn’t work if targeted to 4.0.  Hopefully, we can confirm if that works or not soon.  When you bring up the New Project dialog and click on SharePoint –> 2010, you will see quite a few project templates that you can start with.  Also of note is that these new project templates only work with SharePoint 2010.  Here is what was in my version, when I looked at it (subject to change of course).

    • Import SharePoint Solution Package
    • State Machine Workflow
    • Event Receiver
    • Empty SharePoint Project
    • Module
    • Business Data Connectivity Model
    • Content Type
    • Sequential Workflow
    • List Definition
    • Import Reusable Workflow
    • Site Definition
    • Visual Web Part

    Many of these project types actually just correspond to one of the new SharePoint Project Items (SPI) that I will cover here in a bit.  The thing to point out is that you are not just limited to whatever you pick when you start.  For example, if you create a Content Type project, you can later add a List Definition to it.  With that being said, you typically just end up starting with Empty Project.  The Import WSS Solution Package project type is what you will use to start out migrating your existing solution packages with.  If will import your features and configure a new solution package.  You can then bring your source code in as needed.  We’ll talk more about some of this later.  The Import Reusable Workflow is used to bring over a workflow built in SharePoint Designer.

    Now let’s take a look at what kind of SharePoint Project Items (SPI) we can create.

    • Empty Element
    • User Control
    • Sequential Workflow
    • List Instance
    • Content Type
    • Module
    • Business Data Connectivity Model
    • Web Part
    • List Definition from Content Type
    • Application Page
    • Workflow Association Form
    • Workflow Initiation Form
    • State Machine Workflow
    • Visual Web Part
    • Event Receiver
    • List Definition
    • Global Resource File

    Like I said earlier, a lot of those items map up to the project types.  Did you notice anything missing in the workflow forms?  Yes, they’ve create a great interface for us to deploy association and initiation forms but didn't bother to create anything for Task Forms.  That’s a little big of #FAIL if you ask me.  I encourage you to submit feedback asking for task forms.

    When you create one of these projects, the first thing it is going to ask you is a URL to use for debugging and what type of solution you want to make.  As for the URL, you can specify it here and you can actually change it later.  I’ll say right now that they have improved things a ton and there are not any hard coded URLs or Ids in any thing I have seen yet.  For the solution type, you have two choices: Sandboxed and Farm.  I’ll have an entire post on what these are to give them justice, but for now I’ll just say that Farm will deploy the solution in a similar manner as you did in WSS3.  Sandboxes solutions are a new type of solution that deploys at the site collection level and runs with a lower trust level.  You are typically going to go with the Farm solution.

    The next thing you really need to know about developing for Visual Studio is that a lot of things happen behind the scenes.  Visual Studio manages everything logically and there is no need to replicate the 14 Hive project structure in your project.  The point is that the structure of the hive is abstracted and you really don’t need to keep track of where things go any more.  If you create a web part, it groups all of the related files together, the code file itself, the .webpart file and the elements.xml file.  This goes the same for anything else you might create such as content types, list definitions, workflows, whatever.  Features show up separately and they have a new designer interface.  You can only change some of the basic feature properties such as scope, title, and description, and activation dependencies, but it does give you a separate XML file that you can put your own customization in as well.  Your changes get merged in with what the designer has at build time.  You can also right click on your feature and select add event receiver and you will get a nice wizard which creates a class for you with the overrides you selected.  I’ll talk more about the new changes in event receivers in another post.

    I mentioned above that you can really just hit Ctrl+F5 and start debugging your SharePoint application.  In your project properties page, there is a new tab called Deploy (probably later to be named SharePoint).  This tab configures what exactly happens when you use the Build / Deploy options in Visual Studio.  Here you can configure Visual Studio to build your solution package, add / retract it, recycle IIS, etc.  You can specify the order and I imagine you will be able to add your own custom steps here as well.  Out of the box there are two deployment options.  One to deploy and one that deploys but doesn’t activate any features.  Here are the build steps available.

    • Run Pre-Deployment Command
    • Package wsp
    • Recycle IIS Application Pool
    • Retract Solution
    • Add Solution
    • Activate Features
    • Run Post-Deploment Command

    As you can see, all of the basic steps for deployment something to SharePoint are covered.  I’ll point out that there is still not any direct support for remote development, but since SharePoint will now run on Windows 7 x64 and Windows Vista x64, the need to develop remotely is largely gone.  You can do all of your development locally now.

    That last thing I’ll mention is that they added something called the SharePoint explorer to the toolbox.  This allows you to browse your SharePoint site and view various properties on objects like you have probably seen with other tools in the past with MOSS.  There is obviously far more about the improvements in Visual Studio 2010 that I can cover here, but hopefully this is a good start for those of you that are curious about what’s new.

  • Relational Lists in SharePoint 2010

    In WSS3, there really was no supported way to do relational lists.  Most of us just used lookup columns and we sort of got by.  Of course there was no included support for maintaining referential integrity unless we included it ourselves.  SharePoint 2010 really takes this up a notch with some nice new features.  It also starts with the use of Lookup Columns.

    When you go to create a lookup column, you will see that there are a few new options.  We still set the list we want (sorry no cross-site support in the UI still) and a value field.  However, there is a new option to maintain referential integrity at the bottom of the page.  Here it gives us the option to cascade delete from the parent list to the child list or to simply prevent the delete if any child items still exist. 

    That’s not all though!  Often times in the child list, we would like to see data from the parent list.  For example, we’re viewing invoices and we want to see the actual name of the custom on the invoice and not just the Id.  In the pervious version, this required us to implement custom code to query the list and use LINQ or whatever to make a join.  Fyi, CAML now supports joins, but you probably don’t care because you’ll never use it again due to LINQ to SharePoint.  What is very cool is that it displays a list of site columns from the parent list and will show them on the child list for use in views, etc.  This makes it very easy to produce a good experience to the user out of the box when working with this type of data.

  • Large Lists and Throttling in SharePoint 2010

    SharePoint 2010 has a number of new features centered around working with large lists.  SP2010 can support up to 50 million items in a list now, but you don’t obviously want to return all of those in a single query.  To aid with this, SP2010 introduces list throttling settings (configured at the web application level), that allow you to specify how many items a user can query before the throttle kicks in and aborts the query.  At the time of writing, these limits are set to 5,000 for normal users and 20,000 for super users.  Remember you can change these settings if you so choose.  I’ll be curious to see what numbers people actually end up running with.  This applies to anything that queries the list whether its through the SharePoint UI or from your own custom code.  If the user submits a query that is too large, the SharePoint UI will tell the user that the query is too big and they need to filter it.

    Of course, some people don’t care about throttles and they may want to override it at times.  If the code has the appropriate permissions, you can call RequestThrottleOverride on the SPQuery object and execute large unsafe queries.  If you have existing code that does large queries in your current SharePoint environment that, throttling is definitely something you will want to be aware of.

  • SharePoint 2010 Blog Series

    I’m very excited that we all get to start talking about SharePoint 2010.  There are so many great new features in the products, I think it will be a great platform for building applications next year.  This is the start on my series of blog posts about SP2010.  In some of my posts I talk about specific features in great detail.  Other posts are just quick tips that you might find useful as you start working with the product.  Since we’re talking about a beta product, I’ll go ahead and state my standard disclaimer here.  Features, APIs, schemas are all subject to change.  Anything I talk about I believe to be accurate at the time of writing, so if I get something wrong, try not to flame me too bad. :-)  I’ll do my best to update posts as things change.  If you are interested in things that have changed in SharePoint, a good place to to start is my post: Corey’s Big Post of SP2010 Observations.  Thanks and enjoy SharePoint 2010.

  • Corey’s Big Post of SharePoint 2010 Observations

    Now that the NDA has been lifted, I am excited to talk about some of things that I have noticed are new, interesting, or changed in SharePoint 2010.  This post today is just a bullet list of random things that I thought were worth mentioning. Standard disclaimer: any of these items are subject to change, errors, omissions.  They are in no particular order.  I will detail many of these items more through out the next couple of weeks.  As I will state with all posts on this topic, everything discussed here is subject to change. 

    • As everyone knows SharePoint 2010 is 64 bit only.  For development, SharePoint 2010 will install on Windows 7 x64 and Windows Vista x64.  Good bye Virtual Machines!
    • SharePoint runs on .NET 3.5 SP1 not .NET 4.0
    • People Search has built-in support for wildcard searching
    • Keyword query syntax supports or/and as well as wildcards using an asterisk (*)
    • Search has built-in filters now (RefinementWebPart) with exact document counts – Think faceted search
    • The Enterprise SharePoint CAL includes Fast Search
    • Solution packages (.wsp) can now be deployed to the farm or to a sandbox on a site collection
    • Sandboxed solutions run under partial trust with permission only to ASP.NET web controls and the SharePoint object model
    • Sandboxed solutions cannot do certain privileges operations such as create site collections or elevate privileges
    • Most site definitions are now based upon wiki pages
    • You can deploy web parts directly inside a wiki editable section
    • The 14 Hive replaces the 12 Hive.  Referred to as the “SharePoint Root” now.
    • Stsadm is effectively considered dead and has been replace with PowerShell commands
    • The Shared Services Provider is gone.  Functionality exposed through Services Archicture
    • There are many new site definitions
    • Visual Web Parts are just user controls with a regular web part loading them with Page.LoadControl
    • Application Resource Files now work correctly out of the App_GlobalResources folder
    • Site Columns have a place to enter a validation formula in the UI
    • Lists have a place to enter a list-wide validation formula in the UI
    • Content Types may now be marked readonly in the UI
    • There is a new SharePoint Web Services site in IIS which hosts several services
    • A lot of items have been added to Services on Server
    • WSS Search has a failover database option now
    • Farm Solutions can’t be uploaded in Central Administration but Sandbox solutions can be uploaded to the site collection
    • Granular backup in CA allows export of sites or lists.  Options available to export security, versions, and data
    • Most postbacks have been removed from the UI
    • Obviously you already have heard about the Ribbon Bar
    • Most forms edit as an AJAX modal popup
    • New pages in CA to manage service accounts
    • Patch Management screens in CA
    • New folders in 14 Hive UserCode, WebClients, and WebServices
    • A new page to edit column default value settings in List Settings
    • List Settings –> Advanced: New options to allow offline, turn off the datasheet, or mark as the site asset library
    • New Ratings Settings in List Settings
    • New Metadata Navigation Settings in List Settings
    • New Per-Location View Settings in List Settings
    • Explorer View has been removed
    • XsltListViewWebPart replaces all previous data view web parts
    • New Events: WebAdding, WebProvisioned, ListAdding, ListAdded, ListDeleting, ListDeleted, WorkflowStarted, FeatureUpgrading
    • Event Receivers can be created in Visual Studio with a Wizard
    • You no longer have to implement all events in an Event Receiver
    • Support for relation lists using lookup columns
    • SharePoint now supports 50 million items in a list
    • SharePoint now allows a user to query 5,000 items in a view.  Replaces 2,000 (later 3,000) item recommendation in MOSS 2007
    • Queries in excess of the list throttling limitation will not be executed for normal users.  Throttle limits are configurable at a web application level.
    • Visual Studio 2010 still lags forever when opening Visual Web Parts or Application Pages
    • Application Pages now use the site master page.
    • Collaboration Portal site template has been replaced with Enterprise Wiki
    • CoreResultsWebPart still doesn’t support wildcards with built-in Search Center
    • You can now have multiple index servers
    • Content Sources can specify priority for crawling (normal or high)
    • Document Set is a new content type that allows you to add child content types to it and work with the set of documents as one item
    • Workflows no longer require list items.  Can be assigned to a site or document set
    • The progress of a particular workflow can be viewed in Visio
    • External Data Exchange can be used to wake up workflows externally
    • The Site Actions menu has been moved to the left side
    • SharePoint now has built-in web analytics
    • Cross-Browser Support: Tier 1: Internet Explorer, Firefox.  Tier 2: Safari.  No idea about Chrome and Opera.
    • Word and PowerPoint documents can now be edited directly in a browser (separate install)
    • Application definition files for Business Connectivity Services can be created with SharePoint Designer
    • SharePoint Designer no longer hard codes GUIDs into everything
    • Folders are now supported in Page List for WCM publishing
    • What’s Popular web part displays popular content, search queries, and results
    • Enterprise Content Types – allows content types be defined in one site collection and get replicated to other site collections
    • Document Sets allow you to manage multiple documents of varying content types together
    • In Place Records Management feature allows for documents to be marked as records directly in existing document libraries
    • Hold and eDiscovery feature allows you to place holds on documents in existing document libraries without having to export documents to a separate records center
    • New Document Id Service adds a unique ID to all documents which can be used if the document is ever moved
    • The breadcrumbs control has changed and may take some getting used to (especially in administration pages)
    • New compliance details link on document properties page.  Allows viewing of holds, exemption, record status, and audit log
    • CoreResultsWebPart has methods you can override to affect query execution and results display
    • All other search web parts are still sealed
    • BDC now equals Business Data Connectors.  BCS = Business Connectivity Services (the old BDC)
    • Bulk operations can now be performed on list items
    • Content Type new/edit forms can be built in InfoPath
    • Detached seems to be the new term for customized (ghosted) pages
    • Can now specify Joins and Projected Fields in CAML queries
    • Can add a column constraint in lists now to not allow duplicate values
    • Solutions can have dependencies on each other now (validated at deployment time)
    • Workflow associations can be specified via feature

    I’ll keep adding to this list as I observe things.  I’ll also add links to posts with more detail as I write them.   If you see any errors please let me know.

  • Enabling Content Approval on a List using CAML

    I’ve always liked the power of CAML because it allows me to create so much in SharePoint without ever having to write a line of code.  However, there really isn’t enough examples out there, so I like writing posts like these that focus on doing something very specific with a list.  @SPKyle would say just write some code to do that, but that’s not my style, so I did some digging through the SDK and some experimentation and I figured out how to do it.  Of course there isn’t an attribute called EnableContentApproval.  So, the first thing we have to figure out is what CAML calls content approval.  It turns out CAML refers to this as moderation.  We’ll add this to the SharePoint UI to API translation guide.  Looking at the List element, I find two attributes ModeratedList and ModeratedType.  The description of the both is quite similar, so I decide to try them out one at a time.  I find that setting ModeratedList works but setting ModeratedType does nothing.  No idea why there is two attributes.  Maybe one is deprecated.  Here is what a List element line would like in your schema.xml.

    <List xmlns="http://schemas.microsoft.com/sharepoint/" BaseType="0" DisableAttachments="True" EnableContentTypes="True" Name="MyList" OrderedList="False" QuickLaunchUrl="True" Title="My List" Type="10001" VersioningEnabled="False" Url="Lists/MyList" Id="ed65344b-0399-4c34-8265-de0c2d193165" ModeratedList="TRUE">

    I then go take a look at the list versioning settings of my newly created list, and everything looks good.  Note, if you want to turn on versioning, you can use the VersioningEnabled attribute that you see above.

    ContentApproval

    Again, I set the ModeratedList attribute in the List element of the Schema.xml.  Before I set it on the schema.xml file, I noticed that the ListTemplate element that you use in your elements.xml file had an attribute EnableModeration.  The SDK states this can be used to turn on moderation as well.  However, when using it I find that it does not work.  If I set it to true or false it does not work and does not seem to override I set in the schema.xml file.  Anyhow, if you ever need to turn on content approval and don’t feel like writing code, I hope this helps.

  • ShareHofbrau: Post SPC09 Event

    It just wouldn’t be an event if DotNetMafia didn’t organize a social and SharePoint Conference 2009 is no different.  We’ll call it ShareHofbrau (in keeping with the Share… theme).  Thursday night (10/22) around 6:00pm, we want to see everyone that is sticking around at Hofbrauhaus Las Vegas.  If you aren’t sure what Hobrauhaus is, picture a place where Oktoberfest is everyday and they serve Hofbrau beers.  I know a lot of people are flying home on Thursday night, but I also know a lot aren’t leaving until the morning.  So come by and have a beverage before you leave Vegas and use this as the last opportunity to talk to SharePointers from all over the world.

    Hofbrauhaus is located not far off the strip at 4510 Paradise Road near the Hard Rock Hotel.  So come ready to talk about SharePoint and eat and drink some fine German food and beverages.

    If you are interested in coming, leave a comment, or send me something on twitter, so I can try and get a reservation.  Otherwise just show up and we’ll see you there.

    UPDATE: @EUSP was nice enough to add us to the SPC09 events form.  If you want to come, please go there and let us know.  Thanks.

  • Specifying a list by name in a .UDCX file

    I’ve been working with InfoPath again lately since I’ve been working with Document Information Panels and I thought I would share another quick tip today.  Observe the following .UDCX file.

    <?xml version="1.0" encoding="UTF-8"?>

    <?MicrosoftWindowsSharePointServices ContentTypeID="0x010100B4CBD48E029A4ad8B62CB0E41868F2BF"?>

    <udc:DataSource MajorVersion="2" MinorVersion="0" xmlns:udc="http://schemas.microsoft.com/office/infopath/2006/udc">

      <udc:Name>list_2F9fb67e-ab7d-44b7-accc-d9f6c9ca37f9</udc:Name>

      <udc:Description>Format: UDC V2; Connection Type: SharePointList; Purpose: ReadOnly; Generated by Microsoft Office InfoPath 2007 on 2009-10-05 at 15:02:14 by MOSS-SERVER\moss_setup.</udc:Description>

      <udc:Type MajorVersion="2" MinorVersion="0" Type="SharePointList">

        <udc:SubType MajorVersion="0" MinorVersion="0" Type=""/>

      </udc:Type>

      <udc:ConnectionInfo Purpose="ReadOnly" AltDataSource="">

        <udc:WsdlUrl/>

        <udc:SelectCommand>

          <udc:ListId>2F9fb67e-ab7d-44b7-accc-d9f6c9ca37f9</udc:ListId>

          <udc:WebUrl>http://moss-server/MySiteCollection/</udc:WebUrl>

          <udc:ConnectionString/>

          <udc:ServiceUrl UseFormsServiceProxy="false"/>

          <udc:SoapAction/>

          <udc:Query/>

        </udc:SelectCommand>

        <udc:UpdateCommand>

          <udc:ServiceUrl UseFormsServiceProxy="false"/>

          <udc:SoapAction/>

          <udc:Submit/>

          <udc:FileName>Specify a filename or formula</udc:FileName>

          <udc:FolderName AllowOverwrite=""/>

        </udc:UpdateCommand>

        <!--udc:Authentication><udc:SSO AppId='' CredentialType='' /></udc:Authentication-->

      </udc:ConnectionInfo>

    </udc:DataSource>

    I generated this .UDCX file with InfoPath using the Convert button on the Data Sources form.  As you can see from the ListId element is conveniently hard coded with the GUID of a list.  That makes this .UDCX file absolutely worthless when deployed to a new server.  I looked for some documentation .UDCX to see if I could put a path in for the ListId, but I couldn’t find anything that stated I could.  I tried the path (i.e.: Lists/MyCustomList) and I got a list not found error when I tried to open the form.  So I then decided to just specify the list by its name and sure enough it works.  Here is what it looks like.

    <?xml version="1.0" encoding="UTF-8"?>

    <?MicrosoftWindowsSharePointServices ContentTypeID="0x010100B4CBD48E029A4ad8B62CB0E41868F2BF"?>

    <udc:DataSource MajorVersion="2" MinorVersion="0" xmlns:udc="http://schemas.microsoft.com/office/infopath/2006/udc">

      <udc:Name>list_2f9fb67e-ab7d-44b7-accc-d9f6c9ca37f9</udc:Name>

      <udc:Description>Format: UDC V2; Connection Type: SharePointList; Purpose: ReadOnly; Generated by Microsoft Office InfoPath 2007 on 2009-10-05 at 15:02:14 by MOSS-SERVER\moss_setup.</udc:Description>

      <udc:Type MajorVersion="2" MinorVersion="0" Type="SharePointList">

        <udc:SubType MajorVersion="0" MinorVersion="0" Type=""/>

      </udc:Type>

      <udc:ConnectionInfo Purpose="ReadOnly" AltDataSource="">

        <udc:WsdlUrl/>

        <udc:SelectCommand>

          <udc:ListId>MyCustomList</udc:ListId>

          <udc:WebUrl>http://moss-server/MySiteCollection/</udc:WebUrl>

          <udc:ConnectionString/>

          <udc:ServiceUrl UseFormsServiceProxy="false"/>

          <udc:SoapAction/>

          <udc:Query/>

        </udc:SelectCommand>

        <udc:UpdateCommand>

          <udc:ServiceUrl UseFormsServiceProxy="false"/>

          <udc:SoapAction/>

          <udc:Submit/>

          <udc:FileName>Specify a filename or formula</udc:FileName>

          <udc:FolderName AllowOverwrite=""/>

        </udc:UpdateCommand>

        <!--udc:Authentication><udc:SSO AppId='' CredentialType='' /></udc:Authentication-->

      </udc:ConnectionInfo>

    </udc:DataSource>

    As you can see I just specified the name of my custom list and it works great.  I still have to update the WebUrl when I put this on a new server, but this eliminates the hassle of having to look up and deal with list Ids.

  • 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.

More Posts « Previous page
2012 dotnetmafia.
Powered by Community Server (Non-Commercial Edition), by Telligent Systems