Sharing SharePoint

Always a rookie in the SharePoint World

  • Follow me on Twitter

    Error: Twitter did not respond. Please wait a few minutes and refresh this page.

  • Blog Stats

    • 59,184 hits
  • Advertisements

Customizing RSS Viewer to display forecast

Posted by Jessica Wang on March 25, 2008

Step 1:  Register for Free at to get your Partner ID and License Key

Step 2: Enter*&dayf=6&par=PartnerID&prod=xoap&unit=m&key=LicenseKey into RSS Feed URL

Step 3: Edit the XSL

<?xml version=”1.0″ encoding=”ISO-8859-1″ ?><xsl:stylesheet version=”1.0″ xmlns:xsl=””><xsl:output method=”html” indent=”yes” encoding=”iso-8859-1″ /><xsl:template match=”/weather”>

<xsl:variable name=”med-img-dir”>WeatherIcons/60×59</xsl:variable>

<!–Purpose: Weather Webpart, information from–>

         <xsl:variable name=”day” select=”dayf/day[@d]”></xsl:variable>

        <xsl:for-each select=”$day”>

 <!– Current Weather Conditions –>

<table width=”100%”>



                                <td style=”width: 70px;font-size: 11px” rowspan=”3″>

                                <xsl:variable name=”img-ext”>png</xsl:variable>

                                <xsl:variable name=”iconnumber” select=”part[@p=’d’]/icon” />

                                <img src=”{$med-img-dir}/{$iconnumber}.{$img-ext}” mce_src=”{$med-img-dir}/{$iconnumber}.{$img-ext}” alt=”{$iconnumber}.{$img-ext}” width=”40″ height=”42″ />


                                <!–Day and Date–>

                                <td style=”font-size: 11px; font-weight: bold; padding:0px 0px 0px 0px” colspan=”2″>

                                                                <xsl:value-of select=”./@dt” />,

                                                                <xsl:value-of select=”./@t” />




                                <td style=”font-size: 11px; padding:0px 0px 0px 0px” colspan=”2″>                                        

                                                                <xsl:value-of select=”part[@p=’d’]/t”/>





                                                                <td style=”font-size: 11px; padding:0px 0px 0px 0px”>Min:

                                                                <xsl:value-of select=”low”></xsl:value-of>C </td>

                                                                <td style=”font-size: 11px; padding:0px 0px 0px 0px” >Max:

                                                                <xsl:value-of select=”hi”></xsl:value-of>C </td>







Posted in WebParts, XSLT | Leave a Comment »

Get User Collection from a Sharepoint Group

Posted by Jessica Wang on March 25, 2008

I have been working on getting a drop down list in Infopath to be populated with users of a Sharepoint Group. You can’t connect directly to the drop drop list, so you will need to create 2 data sources, 1 to the web service and another xml file with dummy data which will be replace be information from the web service.

1. Create a data connection to the web service using the data connection wizard.


Data Connection

Click next and select GetUserCollectionFromGroup

Enter Sample data, which is the name of the group which you wish to get data from.

2. You will need dummy data to be connected to the drop down list first. There are 2 dummy users in the xml, it tells infopath that it is repeating.


<?xml version=”1.0″ encoding=”utf-8″ ?>

 <dfs:myFields xmlns:dfs=”; xmlns:s0=”; xmlns:my=”; xmlns:soap=”; xmlns:xsi=”; xmlns:xsd=””&gt;    <dfs:queryFields>        <s0:GetUserCollectionFromGroup>        </s0:GetUserCollectionFromGroup>    </dfs:queryFields>    <dfs:dataFields>        <GetUserCollectionFromGroupResponse xmlns=””&gt;            <GetUserCollectionFromGroupResult>                <GetUserCollectionFromGroup>                    <Users>                        <User ID=”1″ Sid=”S-1-5-21-3593225548-2099380924-3969701235-500″ Name=”User1″ LoginName=”login1″ Email=”” Notes=”” IsSiteAdmin=”False” IsDomainGroup=”False”/>                        <User ID=”2″ Sid=”S-1-5-21-3593225548-2099380924-3969701235-1145″ Name=”User2″ LoginName=”login2″ Email=”” Notes=”” IsSiteAdmin=”False” IsDomainGroup=”False”/>                    </Users>                </GetUserCollectionFromGroup>            </GetUserCollectionFromGroupResult>        </GetUserCollectionFromGroupResponse>    </dfs:dataFields></dfs:myFields>

Save the dummydata.xml and connect it via the Data Connection Wizard as well.

3. Link the drop down list to the dummydata.xml


4. You will need to go to the loading event of the infopath form, which you can get to by going to Tools>Programming>Loading Event

It will open up Visual studio. Within the Loading Event, you will need the following piece of code.

public void FormEvents_Loading(object sender, LoadingEventArgs e)


//Dummy Data

//get an XPathNavigator to our webservice method                                                XPathNavigator dutyManagerDummy = this.DataSources[“DutyManagerListDummyData”].CreateNavigator();

//create the XmlNamespaceManager that will allow us to navigate the xml
umanager = new XmlNamespaceManager(dutyManagerDummy.NameTable);



//get the node that contains all the users from dummy data
DutyManagerListDummyDataName = dutyManagerDummy.SelectSingleNode(“/dfs:myFields/dfs:dataFields/tns:GetUserCollectionFromGroupResponse/tns:GetUserCollectionFromGroupResult/tns:GetUserCollectionFromGroup/tns:Users”, umanager);

//Actual Data

//get an XPathNavigator to our webservice method                                                 XPathNavigator dutyManager = this.DataSources[“GetUserCollectionFromGroup”].CreateNavigator();

//create the XmlNamespaceManager that will allow us to navigate the xml
dmanager = new XmlNamespaceManager(dutyManager.NameTable);



//get the node that contains all the users from the call to the web service
dusers = dutyManager.SelectSingleNode(“/dfs:myFields/dfs:dataFields/tns:GetUserCollectionFromGroupResponse/tns:GetUserCollectionFromGroupResult/tns:GetUserCollectionFromGroup/tns:Users”, umanager);


                             //replace the dummy information from the information from the web service


                         catch(NullReferenceException ee){}


Run the preview and you should see the actual data instead of the dummy information.

Posted in Infopath | 9 Comments »

Customizing Content Query Webpart

Posted by Jessica Wang on March 3, 2008


Firstly, Heather Solomon has an excellent article on it.

Part 1: Export Content Query Web part

Open it up and search for CommonViewFields

Add in Fields that you want; you will need to use the internal name and the type of data.

A good tool is Sharepoint Explorer for WSS 

<property name=”CommonViewFields” type=”string”>InternalName, DateField</property>

Example: Calendar Properties 

<property name=”CommonViewFields” type=”string”>EventDate,DateTime; Description,Note; Location,Text; Property_x0020_Unit,Choice</property>

Save the Web Part and Import it back 

Part 2: Locate ItemStyle.xsl under XSL Style Sheet

Create your own custom Item Style 

<xsl:template name=”CustomStyle” match=”Row[@Style=’CustomStyle’]” mode=”itemstyle”>  <xsl:variable name=”SafeImageUrl”>
            <xsl:call-template name=”OuterTemplate.GetSafeStaticUrl”>
                <xsl:with-param name=”UrlColumnName” select=”‘ImageUrl'”/>
  <xsl:variable name=”SafeLinkUrl”>
            <xsl:call-template name=”OuterTemplate.GetSafeLink”>
                <xsl:with-param name=”UrlColumnName” select=”‘LinkUrl'”/>
  <xsl:variable name=”DisplayTitle”>
            <xsl:call-template name=”OuterTemplate.GetTitle”>
                <xsl:with-param name=”Title” select=”@Title”/>
                <xsl:with-param name=”UrlColumnName” select=”‘LinkUrl'”/>
  <xsl:variable name=”LinkTarget”>
            <xsl:if test=”@OpenInNewWindow = ‘True'” >_blank</xsl:if>
    <td style=”width: 200px”>          
  <xsl:value-of select=”ddwrt:FormatDate(string(@EventDate),3081, 3)”/></td>
    <td valign=”top” rowspan=”3″>|</td>    <td class=”linkitem” style=”width: 200px”>      
    <xsl:call-template name=”OuterTemplate.CallPresenceStatusIconTemplate”/>
                <a href=”{$SafeLinkUrl}” mce_href=”{$SafeLinkUrl}” target=”{$LinkTarget}” title=”mailto:%7B@LinkToolTip}”>
                    <xsl:value-of select=”$DisplayTitle”/>
    <td rowspan=”3″ align=”left”>    
    <xsl:value-of select=”ddwrt:FormatDate(string(@EventDate),3081, 4)”/></td>
    <td>Location: <xsl:value-of select=”@Location”/></td>
    <td >PropertyUnit: <xsl:value-of select=”@Property_x005F_x0020_Unit “/>
    <td> xsl:value-of select=”@Description” disable-output-escaping=”yes”/></td>
    </table>To see what fields are being passed in<xsl:for-each select=”@*”>
    P:<xsl:value-of select=”name()” />

If you want to format the Date Time using ddwrt, remember to add   xmlns:ddwrt=”” within the <xsl:stylesheet> tag.

Posted in WebParts | Leave a Comment »