in

DotNetDeveloper

Bits o this Bits o that

SharePoint

February 2009 - Posts

  • Sharepoint Development - Tools of the trade

    I thought it might be useful to some for me to list the tools i use regularly within my SharePoint development environment and exactly what I use them for.

    In time maybe the list will shrink / expand and is no particular order.

    STSDEV - is an application which creates SharePoint solutions and projects to help with deployment and development.

    SharePoint Manager 2007 - I have tended to use this to snoop around the inner working of a site (You can view practically every property within SharePoint) . You can amend settings but in all honesty it's not recommended. A colleague insists he melted his entire site with it </me shrugs>. Use carefully :) 

    MOSS Feature Generator - I like this application so much. It doesn't do anything big or clever but its simple and does what it says on a tin. I use this to export any created Content Types / Columns / Fields (created within the SharePoint UI) and export them out to be included in my STSDEV projects. It looks like it also does lists and their templates also but I haven't used it for this.

    U2U CAML Query Builder - Great little visual CAML query tool for building CAML querys to be included in your views etc.

    Imtech List Generator - Might be useful to some. Generates list instance XML for inclusion within your projects. Useful if you can't be bothered to generate GUID's and are not so sure about list templated ID's etc.

    Hopefully this small list will be useful to some.

  • Opening list links in a new window

    There is a few posts about this on the internet.

    seems as usual with SharePoint there is a few ways to do this. This is one way which they can be done, The others are by editing a listview within SharePoint Designer right clicking on the list and select dataform XSLT or similar and editing the xsl and saving and this method by Todd Bleeker.

    have a read and see what you think.

     Editing List Schema

    This is a fairly simple process once you know how this is a quick guide on how to do it.

     Add a new boolean column to your list something along the lines of "Open In New Window".

    open up your "schema XML".

     down at the bottom of your schema file there is a <Fields> node open this up and copy paste the code below

    edit the following area's

    URLToOpen - the name of the URL field you want to use to generate the new link

    OpenInNewWindow - The name of the field you created as a the boolean value to decide if to open in a new window or not

    <Field Type="Computed" ReadOnly="TRUE" Name="NewUrlLink" DisplayName="URL" DisplayNameSrcField="URL" AuthoringInfo="open in new window" >
    <
    FieldRefs><FieldRef Name="URLToOpen"/>
    <
    FieldRef Name="OpenInNewWindow"/></FieldRefs>
    <
    DisplayPattern><HTML><![CDATA[<A HREF="]]></HTML>
    <
    Column Name="URLToOpen" HTMLEncode="TRUE"/><HTML><![CDATA["]]></HTML>
    <
    Switch><Expr>
    <
    Column Name="OpenInNewWindow"/></Expr>
    <
    Case Value="1"><HTML><![CDATA[ target="_blank"]]></HTML>
    </
    Case></Switch>
    <
    HTML><![CDATA[>]]></HTML><Switch>
    <
    Expr><Column2 Name="URLToOpen"/>
    </
    Expr><Case Value="">
    <
    Column Name="URLToOpen" HTMLEncode="TRUE"/></Case>
    <
    Default><Column2 Name="URLToOpen" HTMLEncode="TRUE"/>
    </
    Default></Switch>
    <
    HTML><![CDATA[</A>]]></HTML></DisplayPattern>
    </
    Field>

    ok with that done now you can just use that computed column within your schema xml as a valid field.

     just add that field in the <ViewFields> part of your view ie :
    <
    FieldRef Name="NewUrlLink" />

     This is a simplified rundown of the process based on my experiences with this. check out Andrew Connells blog if you need more information Andrews Connell's post can be found here and has more detail then mine.

  • Deploying Custom Lists with STSDEV

    This is only a quick and dirty post as I'm really busy atm. This is obviously the most basic tutorial explaining how to quickly and easily take your  lists from within sharepoint and make them deployable (I'm using STSDEV).

     Firstly create your list within the Sharepoint as normal.

    Open Sharepoint Solution Generator

    Enter your site details,select the list you want to deploy and save into a folder on your desktop.

    This generates a stand alone project for deploying this list if this is what you want.

    To embed in a larger project

    Copy the 4 ASPX files and the Schema.XML files into your project and place them in a listfolder (eg: "My List")

    Edit the "Elements.XML" and copy the contents from the "ListDefinition.XML" file into it.

    Open up the "Feature.XML" and add the following

    <!-- Lists -->

    <ElementFile Location="My List\schema.xml"/>

    <ElementFile Location="My List\AllItems.aspx"/>

    <ElementFile Location="My List\DispForm.aspx"/> <ElementFile Location="My List\NewForm.aspx"/>

    <ElementFile Location="My List\EditForm.aspx"/>

     finally within your "Elements.XML" add the following making sure to change the feature ID and generate a new Guid for the List Instance ID

    <ListInstance

    Id="874CE39B-0E8A-40c6-B284-36679BD5CC33"

    FeatureId="314CAAC1-7E0D-4FAE-921C-30EEC7D7302A"

    TemplateType="100"

    Title="Press Releases"

    Description="Press Releases"

    Url="Lists/Press Releases" />

    Take note of the Template Type, this should match between the template and the instance. There are a fair few different template types however Solution Generator should export the correct type for you.

    for other types have a look here if you need too. Other Template Types

    Now you should have your deployable list

    hopefully this will be useful as a starting point for somebody.

DotNetDeveloper.co.uk
Powered by Community Server (Non-Commercial Edition), by Telligent Systems