<?xml version="1.0" encoding="utf-8"?>
<feed xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xml:lang="en-us" xmlns="http://www.w3.org/2005/Atom">
  <title>Lucy's blog</title>
  <link rel="alternate" type="text/html" href="http://blogs.tamtam.nl/lucy/" />
  <link rel="self" href="http://blogs.tamtam.nl/lucy/SyndicationService.asmx/GetAtom" />
  <icon>favicon.ico</icon>
  <updated>2009-11-02T16:51:18.69225+01:00</updated>
  <author>
    <name>Lucy de Boer</name>
  </author>
  <subtitle>Lucy's SharePointblog.</subtitle>
  <id>http://blogs.tamtam.nl/lucy/</id>
  <generator uri="http://dasblog.info/" version="2.3.9074.18820">DasBlog</generator>
  <entry>
    <title>Retrieve userprofile in a webservice</title>
    <link rel="alternate" type="text/html" href="http://blogs.tamtam.nl/lucy/2009/11/02/RetrieveUserprofileInAWebservice.aspx" />
    <id>http://blogs.tamtam.nl/lucy/PermaLink,guid,e5b47eaf-e6c6-40f5-9de9-cbc5ddb5f2f3.aspx</id>
    <published>2009-11-02T16:50:24.957+01:00</published>
    <updated>2009-11-02T16:51:18.69225+01:00</updated>
    <category term="SharePoint" label="SharePoint" scheme="http://blogs.tamtam.nl/lucy/CategoryView,category,SharePoint.aspx" />
    <author>
      <name>Lucy de Boer</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
When retrieving a UserProfile via UserProfileManager in a webservice, you need to
change the value for 'HttpHandlerSPWeb' in the HttpContext.Current to your web. Otherwise
no profile and you will get 'Operation is not valid due to the current state of the
object'. Not a very helpful message.
</p>
        <pre>
          <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: black; FONT-SIZE: 11px">
            <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">if</span> (HttpContext.Current
!<span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">=</span><span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">null</span>)
{     HttpContext.Current.Items[<span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"HttpHandlerSPWeb"</span>] <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">=</span><span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">new</span> SPSite(serverurl).RootWeb;
}</span>
        </pre>
        <p>
          <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: black; FONT-SIZE: 11px">
          </span> 
</p>
        <p>
And don't forget to run the code to retrieve the profile with elevated privileges.
</p>
      </div>
    </content>
  </entry>
  <entry>
    <title>Using the CrossListQueryCache with Audience Filtering</title>
    <link rel="alternate" type="text/html" href="http://blogs.tamtam.nl/lucy/2009/10/27/UsingTheCrossListQueryCacheWithAudienceFiltering.aspx" />
    <id>http://blogs.tamtam.nl/lucy/PermaLink,guid,ba0f5f97-cf25-4b4b-9b8b-50dc0d4b9b52.aspx</id>
    <published>2009-10-27T11:10:24.782+01:00</published>
    <updated>2009-10-27T11:16:51.235625+01:00</updated>
    <category term="SharePoint" label="SharePoint" scheme="http://blogs.tamtam.nl/lucy/CategoryView,category,SharePoint.aspx" />
    <author>
      <name>Lucy de Boer</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
For anyone needing to query data from several lists in a site collection the CQWP
is the best tool to do so. However, sometimes you just need more flexibility. So did
I, I am working on a News webpart which allows for tabs and filtering per tab on,
well, basically anything you could want to filter on. Plus it is all asynchronous
loading with jquery. 
</p>
        <p>
So, I wanted to create a webservice to give me my news pages from the entire site
collection. A rather cool but relatively unused way to do this is to use the CrossListQueryCache
and CrossListQueryInfo. This is the class that the ContentByQueryWebPart also uses
to retrieve it's data. The advantage of this class vs SiteDataQuery is that this has
built in caching and audience filtering. There are a few need-to-knows though
to get this to work correctly.
</p>
        <p>
Basically, to get the CrossListQueryInfo and CrossListQueryCache to work isn't
rocket science, you can google enough about it. a rather nice blogpost about it can
be found here: <a href="http://bloggingabout.net/blogs/bas/archive/2009/03/27/using-the-crosslistqueryinfo-and-crosslistquerycache.aspx">http://bloggingabout.net/blogs/bas/archive/2009/03/27/using-the-crosslistqueryinfo-and-crosslistquerycache.aspx</a></p>
        <p>
However, to get Audience Targeting to work is another story. It seems so simple, setting
two properties in your CrossListQueryInfo:
</p>
        <pre>
          <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: black; FONT-SIZE: 11px">clqinfo.FilterByAudience <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">=</span><span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">true</span>;
clqinfo.ShowUntargetedItems <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">=</span><span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">true</span>;</span>
        </pre>
        <p>
          <br />
However this will still give you results, but will not filter. The class works as
follows: first it queryies the lists and retrieves the data. After this, audience
filtering is applied. To filter the audience, the audience info must be present in
the data. So, add it to the viewfields as follows:
</p>
        <pre>
          <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: black; FONT-SIZE: 11px">
            <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">string</span> viewFields <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">=</span><span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"&lt;FieldRef
Name=\"Title\"/&gt;"</span><span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">+</span><span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"&lt;FieldRef
Name=\"ContentType\"/&gt;"</span><span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">+</span><strong>-----
snip -----<br /></strong></span>
          <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: black; FONT-SIZE: 11px">
            <span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"&lt;FieldRef
Name=\"FileRef\" Nullable=\"True\"/&gt;"</span>
            <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">+</span>
            <br />
            <br />
          </span>
          <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: black; FONT-SIZE: 11px">
            <strong>(<span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">string</span>.Format(<span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"&lt;FieldRef
Name=\"{0}\" Type=\"{1}\" /&gt;"</span>, 
<br />
    <span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"{"</span><span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">+</span> FieldId.AudienceTargeting.ToString() <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">+</span><span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"}"</span>, 
<br />
    <span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"TargetTo"</span>));</strong>
          </span>
        </pre>
        <p>
          <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: black; FONT-SIZE: 11px">
            <font color="#003300" size="2" face="Verdana">
              <br />
And presto, now you will have audience filtering. 
<br />
Note: because the audience filtering is applied after retrieving the data, specifying
an rowlimit, this will result in less results after filtering. Make sure your
rowlimit is high enough to allow the necessary amount of results to show
up in your webpart after filtering. This is also a bug in CQWP and there's no fix
as of yet. But you can workaround it in your code.</font>
          </span>
        </p>
        <pre>
          <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: black; FONT-SIZE: 11px">
            <font color="#003300" size="2">
            </font>
          </span> </pre>
        <pre>
          <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: black; FONT-SIZE: 11px">
            <font color="#003300" size="2">
            </font>
          </span> </pre>
      </div>
    </content>
  </entry>
  <entry>
    <title>Create the welcome page for a Wiki Library from code</title>
    <link rel="alternate" type="text/html" href="http://blogs.tamtam.nl/lucy/2009/10/06/CreateTheWelcomePageForAWikiLibraryFromCode.aspx" />
    <id>http://blogs.tamtam.nl/lucy/PermaLink,guid,4b66a449-6654-4054-998d-2f735e3244cb.aspx</id>
    <published>2009-10-06T13:39:33.257+02:00</published>
    <updated>2009-10-06T13:40:06.929+02:00</updated>
    <category term="SharePoint" label="SharePoint" scheme="http://blogs.tamtam.nl/lucy/CategoryView,category,SharePoint.aspx" />
    <author>
      <name>Lucy de Boer</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Sounds simple enough, but note that you also want your welcome page to show when
you click the library. If not visitors are directed to the list. So you must
generate some content and set the welcomepage for the wiki list.
</p>
        <pre>
          <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: black; FONT-SIZE: 11px">
            <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px">  
// Create Knowledge List</span>     SPList knowList <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">=</span> ListCreator.CreateList(currentWeb, <span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"Knowledge"</span>, <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">null</span>,
SPListTemplateType.WebPageLibrary, <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">false</span>, <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">false</span>, <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">false</span>, <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">true</span>, <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">true</span>, <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">false</span>); <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">this</span>.generateWikiContent(knowList); <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px">//
Create Procedure List</span> SPList procList <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">=</span> ListCreator.CreateList(currentWeb, <span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"Procedures"</span>, <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">null</span>,
SPListTemplateType.WebPageLibrary, <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">false</span>, <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">false</span>, <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">false</span>, <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">true</span>, <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">true</span>, <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">false</span>); <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">this</span>.generateWikiContent(procList); <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">private</span><span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">void</span> generateWikiContent(SPList
wikilist) { <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">try</span> {
wikilist.ParentWeb.AllowUnsafeUpdates <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">=</span><span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">true</span>;
SPFolder rootFolder <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">=</span> wikilist.RootFolder;
SPFile wikiHome <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">=</span> rootFolder.Files.Add(String.Format(<span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"{0}/{1}"</span>,
rootFolder,<br />
                   <span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"Home.aspx"</span>),
SPTemplateFileType.WikiPage); SPListItem wikiItem <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">=</span> wikiHome.Item;
wikiItem[SPBuiltInFieldId.WikiField] <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">=</span> wikiHomeText; <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px">//
string with your html </span> wikiItem.UpdateOverwriteVersion(); SPFile wikiHow <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">=</span> rootFolder.Files.Add(String.Format(<span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"{0}/{1}"</span>,
rootFolder,<br />
                   <span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"How
To Use This Wiki Library.aspx"</span>), SPTemplateFileType.WikiPage); SPListItem wikiHowitem <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">=</span> wikiHow.Item;
wikiHowitem[SPBuiltInFieldId.WikiField] <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">=</span> wikiHowText; <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px">//
string with your html</span> wikiHowitem.UpdateOverwriteVersion(); wikilist.RootFolder.WelcomePage <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">=</span><span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"Home.aspx"</span>;
wikilist.RootFolder.Update(); } <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">catch</span> {
} } </span>
        </pre>
      </div>
    </content>
  </entry>
  <entry>
    <title>Webparts disappear from pagelayout when creating a new page</title>
    <link rel="alternate" type="text/html" href="http://blogs.tamtam.nl/lucy/2009/09/28/WebpartsDisappearFromPagelayoutWhenCreatingANewPage.aspx" />
    <id>http://blogs.tamtam.nl/lucy/PermaLink,guid,7b085ae4-6265-47f1-911e-adf7e1547612.aspx</id>
    <published>2009-09-28T16:05:17.458+02:00</published>
    <updated>2009-09-28T16:07:03.271375+02:00</updated>
    <category term="SharePoint" label="SharePoint" scheme="http://blogs.tamtam.nl/lucy/CategoryView,category,SharePoint.aspx" />
    <author>
      <name>Lucy de Boer</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
A while back I made a custom pagelayout for my client, with lots of content query
webparts already configured and placed in their webpart zones so that on creation
of a new page, everything was in place and working fine.<br />
A few weeks later I heard that suddenly new pages created based on this pagelayout
were showing up empty, no web parts were appearing on creation. However, when I checked
the pagelayout the webparts were still configured and present. 
</p>
        <p>
After some comparison with the last working version I noticed the difference was that
now the property<strong> '__webpartid'</strong> was filled. 
<br />
A collegue had made a quick change to the page in SharePoint Designer, but
appearantly when the page is opened in SharePoint Designer and saved again, this
property is also added and filled. This is what caused the webparts not
to be added on creation of a new page. 
</p>
        <p>
          <strong>Remove the '__webpartid' property and it will work fine again.</strong> Or
better yet: get your last working copy from your sourcecontrol and redo your
SD changes in notepad, Visual Studio, or anything other than SharePoint Designer.
SD messes with code a bit too often imho.
</p>
      </div>
    </content>
  </entry>
  <entry>
    <title>Two things</title>
    <link rel="alternate" type="text/html" href="http://blogs.tamtam.nl/lucy/2009/09/11/TwoThings.aspx" />
    <id>http://blogs.tamtam.nl/lucy/PermaLink,guid,7b11de9d-37ad-40ad-98bc-96dce8ca636c.aspx</id>
    <published>2009-09-11T16:21:48.7+02:00</published>
    <updated>2009-09-11T16:50:05.84075+02:00</updated>
    <category term="SharePoint" label="SharePoint" scheme="http://blogs.tamtam.nl/lucy/CategoryView,category,SharePoint.aspx" />
    <author>
      <name>Lucy de Boer</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
No techie stuff in this post, just two things I thought I would share.
</p>
        <p>
First: I have been a bad, bad blogger. I will make amends and blog more often. No,
really, I promise this time. 
</p>
        <p>
Second: I've been long due for getting my <a href="http://www.microsoft.com/learning/en/us/certification/cert-sharepoint-server.aspx#tab2">certifications
for SharePoint</a>, Two of the four available SharePoint certifications I have had since
way back in 2007, but I didn't do any more ever since. As the prerequisite
for attending the upcoming '<a href="http://sharepoint.microsoft.com/topics/Pages/IgniteProgram4.aspx">Ignite</a>'
sessions was passing <a href="http://www.microsoft.com/learning/en/us/exam.aspx?ID=70-542">70-542</a> this was
a good motivator to study and get the other two also. 
<br /><br />
So, now I am proud MCTS in exam <a href="http://www.microsoft.com/learning/en/us/exam.aspx?ID=70-541">70-541</a>, <a href="http://www.microsoft.com/learning/en/us/exam.aspx?ID=70-542">70-542</a>, <a href="http://www.microsoft.com/learning/en/us/exam.aspx?ID=70-630">70-630</a> and <a href="http://www.microsoft.com/learning/en/us/exam.aspx?ID=70-631">70-631</a>.
and as a bonus i figured hey, while I'm at it lets go .NET and threw in <a href="http://www.microsoft.com/learning/en/us/exam.aspx?ID=70-536">70-536</a> also. 
</p>
        <p>
Sad part is I've lucked out and have been waitlisted for Ignite after all. boohoo. 
</p>
        <p>
 
</p>
      </div>
    </content>
  </entry>
  <entry>
    <title>Adding an extra ItemStyle.xsl to your ContentQueryWebpart through code</title>
    <link rel="alternate" type="text/html" href="http://blogs.tamtam.nl/lucy/2009/09/11/AddingAnExtraItemStylexslToYourContentQueryWebpartThroughCode.aspx" />
    <id>http://blogs.tamtam.nl/lucy/PermaLink,guid,a9941b07-c8f5-4cb2-8113-0c0c3b769c88.aspx</id>
    <published>2009-09-11T15:43:18.481+02:00</published>
    <updated>2009-09-11T15:44:55.59075+02:00</updated>
    <category term="CQWP" label="CQWP" scheme="http://blogs.tamtam.nl/lucy/CategoryView,category,CQWP.aspx" />
    <category term="SharePoint" label="SharePoint" scheme="http://blogs.tamtam.nl/lucy/CategoryView,category,SharePoint.aspx" />
    <author>
      <name>Lucy de Boer</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
If you are adding a (standard or custom) ContentByQueryWebPart through code and
you want to add the link to your custom ItemStyle.xsl you will run into the following
problem:
</p>
        <p>
My scenario was adding the webparts to the pagelayout through code on site creation.
I added a new Custom ItemStyle 'CustomItemStyle.xsl' next to the default xsl,
however after site creation the webpart still referred to the default ItemStyle file.
You will recieve no error messages.<br /><br />
Sharepoint requires knowing the current HttpContext before being able to set the link
to the custom file in the webpart, if HttpContext is empty, fill it before setting
the part and it will work.
</p>
        <pre>
          <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: black; FONT-SIZE: 11px">
            <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px">//
Add a list view to the bottom of the zone.</span>
            <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">if</span> (HttpContext.Current
== <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">null</span>)
{ HttpRequest request <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">=</span><span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">new</span> HttpRequest(<span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">""</span>,
newweb.Url, <span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">""</span>);
HttpContext.Current <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">=</span><span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">new</span> HttpContext(request, <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">new</span> HttpResponse(<span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">new</span> StringWriter()));
HttpContext.Current.Items[<span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"HttpHandlerSPWeb"</span>] <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">=</span> newweb;
} ContentByQueryWebPart part <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">=</span><span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">new</span> ContentByQueryWebPart();
part.Title <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">=</span> title;
part.ItemStyle <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">=</span> itemstylename;
part.ListGuid <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">=</span> listguid;
part.ItemLimit <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">=</span> 5;
part.CommonViewFields <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">=</span> commonviewfields;
part.Xsl <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">=</span><span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"&amp;lt;xsl:stylesheet
xmlns:x=\"http://www.w3.org/2001/XMLSchema\" version=\"1.0\" 
<br />
   xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" xmlns:cmswrt=\"http://schemas.microsoft.<br />
   com/WebPart/v3/Publishing/runtime\" exclude-result-prefixes=\"xsl
cmswrt x\" &amp;gt; &amp;lt;xsl:<br />
   import href=\"/Style Library/XSL Style Sheets/Header.xsl\" /&amp;gt;
&amp;lt;xsl:import href=\"/Style 
<br />
   Library/XSL Style Sheets/CustomItemStyle.xsl\" /&amp;gt; &amp;lt;xsl:import
href=\"/Style Library/XSL 
<br />
   Style Sheets/ContentQueryMain.xsl\" /&amp;gt; &amp;lt;/xsl:stylesheet&amp;gt;"</span>;
part.ItemXslLink <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">=</span><span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"/Style
Library/XSL Style Sheets/CustomItemStyle.xsl"</span>; wpm.AddWebPart(part, zoneId,
zoneIndex); wpm.SaveChanges(part); </span>
        </pre>
        <p>
          <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: black; FONT-SIZE: 11px">
          </span> 
</p>
      </div>
    </content>
  </entry>
  <entry>
    <title>Retrieve pageurl in SPSiteDataQuery </title>
    <link rel="alternate" type="text/html" href="http://blogs.tamtam.nl/lucy/2009/06/02/RetrievePageurlInSPSiteDataQuery.aspx" />
    <id>http://blogs.tamtam.nl/lucy/PermaLink,guid,4fef377c-0c22-4aab-aa6b-3f90757aba73.aspx</id>
    <published>2009-06-02T16:50:51.314+02:00</published>
    <updated>2009-09-11T15:50:09.02825+02:00</updated>
    <category term="SharePoint" label="SharePoint" scheme="http://blogs.tamtam.nl/lucy/CategoryView,category,SharePoint.aspx" />
    <author>
      <name>Lucy de Boer</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
According to the web, using <font color="#a52a2a">&lt;FieldRef Name=\"EncodedAbsUrl\"/&gt;</font> is
the way to retrieve the item url when using SPSiteDataQuery. However, for me (and
others) this doesn't seem to work, only returning the root site url. 
<br /><font color="#a52a2a">&lt;FieldRef Name=\"ServerUrl\"/&gt;</font> appeared to be even
more useless always returning only "/". 
<br />
Appearantly this has something to do with the scope being used with SPSiteDataQuery.
</p>
        <p>
However, you can still use <font color="#a52a2a">&lt;FieldRef Name=\"FileRef\"/&gt;.</font><br />
This will return a value like 7:#News/Pages/yourpage.aspx, and the last part is always
server relative so useful enough. just chuck out what you don't need and make a url:<br /><font size="1"><br /></font><font color="#a52a2a">dr["EncodedAbsUrl"].ToString() + (<font color="#a31515">new
SPFieldLookupValue(dr["FileRef"] as string).LookupValue)</font>; }</font><br /><font color="#a31515" size="2"><font color="#a31515" size="2"><font color="#a31515" size="2"><font color="#a31515" size="2"><font color="#a31515" size="2"><font color="#a31515" size="2"><font size="2"><font color="#003300" size="1"><br />
---- edited to lookupvalue thanks to Keiths tip, thanks Keith ----</font></font></font></font></font></font></font></font></p>
      </div>
    </content>
  </entry>
  <entry>
    <title>Start worklfow from code</title>
    <link rel="alternate" type="text/html" href="http://blogs.tamtam.nl/lucy/2008/03/07/StartWorklfowFromCode.aspx" />
    <id>http://blogs.tamtam.nl/lucy/PermaLink,guid,a968f4f1-d433-476d-9764-319d3906290d.aspx</id>
    <published>2008-03-07T13:52:00.476+01:00</published>
    <updated>2008-03-07T13:58:09.5391063+01:00</updated>
    <category term="SharePoint" label="SharePoint" scheme="http://blogs.tamtam.nl/lucy/CategoryView,category,SharePoint.aspx" />
    <category term="Workflow" label="Workflow" scheme="http://blogs.tamtam.nl/lucy/CategoryView,category,Workflow.aspx" />
    <author>
      <name>Lucy de Boer</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
I wrote an eventhandler which needs to update a publishingpage to the next minor version
and (re)start a workflow from code.
</p>
        <p>
Cleaning up any running workflows of the same type will prevent 'Exception from HRESULT:
0x8102009B'.
</p>
        <p>
          <font face="Courier New">foreach (SPWorkflowAssociation wfAssoc in item.ContentType.WorkflowAssociations)<br />
       {<br />
// search workflowassociation by name<br />
        if ((wfAssoc.Name.ToLower().Contains("controleren"))
&amp;&amp; (wfAssoc.Name.ToLower().Contains("publicatie")))<br />
        {<br />
// check current item for running workflows of the same type<br />
         foreach(SPWorkflow wf in item.Workflows)<br />
         {<br />
          if (wf.ParentAssociation.Name.Equals(wfAssoc.Name))<br />
          {<br />
// remove running workflow<br />
           item.Web.Site.WorkflowManager.RemoveWorkflowFromListItem(wf);<br />
          }<br />
         }<br />
// start workflow<br />
         item.Web.Site.WorkflowManager.StartWorkflow(item,
wfAssoc, wfAssoc.AssociationData);<br />
         break;<br />
        }<br />
       }</font>
        </p>
        <p>
 
</p>
      </div>
    </content>
  </entry>
  <entry>
    <title>VS 2008 workflow will not start</title>
    <link rel="alternate" type="text/html" href="http://blogs.tamtam.nl/lucy/2008/02/29/VS2008WorkflowWillNotStart.aspx" />
    <id>http://blogs.tamtam.nl/lucy/PermaLink,guid,cb153380-5706-44f2-a922-c8a067ea1690.aspx</id>
    <published>2008-02-29T13:29:03.22+01:00</published>
    <updated>2008-02-29T13:29:03.3927163+01:00</updated>
    <category term="SharePoint" label="SharePoint" scheme="http://blogs.tamtam.nl/lucy/CategoryView,category,SharePoint.aspx" />
    <category term="Workflow" label="Workflow" scheme="http://blogs.tamtam.nl/lucy/CategoryView,category,Workflow.aspx" />
    <author>
      <name>Lucy de Boer</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">When deploying a VS 2008 workflow developed
in .net 3.5 to a server (w.o. 3.5) the workflow will not start, and the error log
will say ‘System.Core’ not found. 
<br /><br />
To fix this: install .Net3.5 on your server. 
<br /><a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=333325FD-AE52-4E35-B531-508D977D32A6&amp;displaylang=en">http://www.microsoft.com/downloads/details.aspx?FamilyID=333325FD-AE52-4E35-B531-508D977D32A6&amp;displaylang=en</a><br /><br />
Kudo’s again to <a href="http://blogs.tamtam.nl/Stef">Stef</a> for finding this.<br /><p></p></div>
    </content>
  </entry>
  <entry>
    <title>Unknown Task Type</title>
    <link rel="alternate" type="text/html" href="http://blogs.tamtam.nl/lucy/2008/02/29/UnknownTaskType.aspx" />
    <id>http://blogs.tamtam.nl/lucy/PermaLink,guid,34e41a50-9891-4539-8f3c-ab1d8b8d9e91.aspx</id>
    <published>2008-02-29T13:24:19.642+01:00</published>
    <updated>2008-02-29T13:26:10.2208413+01:00</updated>
    <category term="SharePoint" label="SharePoint" scheme="http://blogs.tamtam.nl/lucy/CategoryView,category,SharePoint.aspx" />
    <category term="Workflow" label="Workflow" scheme="http://blogs.tamtam.nl/lucy/CategoryView,category,Workflow.aspx" />
    <author>
      <name>Lucy de Boer</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
When creating a site collection based on the team site or document centre the feature
‘ReviewRouting’ is not enabled (yet). This results in ‘unknown task type’ in the error
logs and 'Error Occurred' in the workflow status screen. 
<br /><br />
To fix this: 
<br />
Enable the standard SharePoint feature ReviewRouting: Id = 02464C6A-9D07-4F30-BA04-E9035CF54392<br /><br />
Kudo’s to <a href="http://blogs.tamtam.nl/stef">Stef</a> for finding this.<br /></p>
      </div>
    </content>
  </entry>
  <entry>
    <title>Assign a task to a Group</title>
    <link rel="alternate" type="text/html" href="http://blogs.tamtam.nl/lucy/2008/02/29/AssignATaskToAGroup.aspx" />
    <id>http://blogs.tamtam.nl/lucy/PermaLink,guid,36e2c7c9-4df5-449a-a24c-c29658b142fe.aspx</id>
    <published>2008-02-29T13:10:11.892+01:00</published>
    <updated>2008-02-29T13:41:05.1427163+01:00</updated>
    <category term="SharePoint" label="SharePoint" scheme="http://blogs.tamtam.nl/lucy/CategoryView,category,SharePoint.aspx" />
    <category term="Workflow" label="Workflow" scheme="http://blogs.tamtam.nl/lucy/CategoryView,category,Workflow.aspx" />
    <author>
      <name>Lucy de Boer</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Assigning a (workflow)task to a Group from code can be tricky, but this trick works:
</p>
        <p>
          <font face="Courier New">SPGroup group = SPWeb.UserGroups[“groupname”];<br />
SPFieldUserValue groupvalue = new SPFIeldUserValue(                 
group.ParentWeb, group.ID, group.Name);<br />
SPWorkflowTaskProperties taskProperties = new SPWorkflowTaskProperties();<br />
 (Connect these taskproperties to the task to update)<br /><br />
taskProperties.AssignedTo = groupvalue.LookupValue;</font>
        </p>
        <p>
To display these tasks in the task list the view 'Groups' has to be selected. they
will not shop up in the 'My Tasks' view.
</p>
        <p>
 
</p>
      </div>
    </content>
  </entry>
  <entry>
    <title>Workflow in VSTO 2008</title>
    <link rel="alternate" type="text/html" href="http://blogs.tamtam.nl/lucy/2008/01/25/WorkflowInVSTO2008.aspx" />
    <id>http://blogs.tamtam.nl/lucy/PermaLink,guid,8ff8a588-23bc-4790-9d45-bb0a54ba5245.aspx</id>
    <published>2008-01-25T17:01:44.115+01:00</published>
    <updated>2008-01-25T17:01:46.0528064+01:00</updated>
    <category term="SharePoint" label="SharePoint" scheme="http://blogs.tamtam.nl/lucy/CategoryView,category,SharePoint.aspx" />
    <category term="Workflow" label="Workflow" scheme="http://blogs.tamtam.nl/lucy/CategoryView,category,Workflow.aspx" />
    <author>
      <name>Lucy de Boer</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
As mentioned before I was going to give VS 2008 a go with developing workflows and
boy, I wish they had come up with this sooner. 
</p>
        <p>
If you are starting any workflow project then take the time to install 2008, it is
well worth it and will save you lots of time and frustration.
</p>
        <p>
You write your code, hit F5 and VSTO 2008 handles the rest for you: building, deploying,
associating your workflow with your list, attaching the debugger and launches the
browser. After this you manually start the workflow and debug away!
</p>
        <p>
          <strong>Debugging with Visual Studio 2008:</strong>
        </p>
        <p>
The project template is situated under 'Office', '2007':
</p>
        <p>
          <img src="http://blogs.tamtam.nl/lucy/content/binary/newproj1.jpg" border="0" />
        </p>
        <p>
Assign the location of your list to associate your workflow with:
</p>
        <p>
          <img src="http://blogs.tamtam.nl/lucy/content/binary/newproj2.jpg" border="0" />
        </p>
        <p>
Write your workflow and when ready, hit F5 and see what happens.
</p>
        <p>
 
</p>
        <p>
          <img src="http://blogs.tamtam.nl/lucy/content/binary/debug.jpg" border="0" />
        </p>
        <p>
Just one little glitch: When Re-deploying / debugging, remove the workflow.xml and
feature.xml files from your feature folder or you will get an error message.
</p>
        <p>
          <img src="http://blogs.tamtam.nl/lucy/content/binary/delete.jpg" border="0" />
        </p>
        <p>
 
</p>
      </div>
    </content>
  </entry>
  <entry>
    <title>Issues with the “Delay” activity in SharePoint workflows</title>
    <link rel="alternate" type="text/html" href="http://blogs.tamtam.nl/lucy/2008/01/07/IssuesWithTheDelayActivityInSharePointWorkflows.aspx" />
    <id>http://blogs.tamtam.nl/lucy/PermaLink,guid,e454d683-394a-4e64-8c66-064b06819ea5.aspx</id>
    <published>2008-01-07T16:58:13.856+01:00</published>
    <updated>2008-01-07T16:58:48.1533313+01:00</updated>
    <category term="SharePoint" label="SharePoint" scheme="http://blogs.tamtam.nl/lucy/CategoryView,category,SharePoint.aspx" />
    <category term="Workflow" label="Workflow" scheme="http://blogs.tamtam.nl/lucy/CategoryView,category,Workflow.aspx" />
    <author>
      <name>Lucy de Boer</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
SharePoint Products and Technologies Team Blog published a post on the Delay activity
problems within workflow:
</p>
        <p>
          <em>"...... As for status, this is a top priority issue for us, and we are actively
investigating as we speak!  We currently have a fix that makes things substantially
better for the issues that have been reproduced internally, but we don't have enough
information on customer reported issues to know if the fix will address all of them.
....."</em>
          <br />
          <a href="http://blogs.msdn.com/sharepoint/archive/2008/01/04/issues-with-the-delay-activity-in-sharepoint-workflows-we-need-your-help.aspx">http://blogs.msdn.com/sharepoint/archive/2008/01/04/issues-with-the-delay-activity-in-sharepoint-workflows-we-need-your-help.aspx</a>
        </p>
        <p>
So if you came here because you have a problem with your delay activity which the
fix won't solve, get over there and post it!
</p>
      </div>
    </content>
  </entry>
</feed>