On the MSDN forums I answered a blog posting about how to update some values of a user profile.  I’ve answered this question more than a few times so I threw up this posting about it.

Here is some basic code to achieve this (its actually from MSDN but I’ve written the same code enough times just couldn’t find it offhand)

using (SPSite site = new SPSite("http://servername"))
    ServerContext context = ServerContext.GetContext(site);
    UserProfileManager profileManager = new UserProfileManager(context);
    string sAccount = "domainname\\username";
    UserProfile u = profileManager.GetUserProfile(sAccount);
    u[PropertyConstants.PictureURL].Value = "SOME URL";



Be sure to check out MSDN for the members of the PropertyConstants.

Tony Testa posted on March 15, 2009 03:48

A few days late but I finally got to posting my code/slides for the March Office Geeks we had on March 10th.  I've zipped up the code that I went over during the presentation which will show you some of the ways you can incorporate MS AJAX and jQuery into your SharePoint sites.



SharePoint has issues with using keywords "today" and "my". Due to this issue, a few workarounds have to be done to achieve the "Today" functionality. See steps below to create a "rolling" calendar view that shows calendar entries for X number of months out.

FYI, MS has on their site a list of some advanced filter options that I would recommend if your looking to do filtering, check it out, it helped me a lot http://office.microsoft.com/en-us/sharepointtechnology/HA011609471033.aspx


  1. Go to your Calendar list and create a column named "Today" and select "single line of text" and do not add it to the default view. This column is merely a placeholder column to achieve "Today" functionality that we can use to filter views
  2. Create a new column named "RollingDateFilter", make it a "calculated column"
    1. Set the calculated formula to "=AND(MONTH([Start Time])>=MONTH(Today),MONTH([Start Time])<=MONTH(Today)+2)"
      1. This formula will be used to filter our list
      2. If you want to see more months out, change 2 in the formula above to the # of months you want to see.
    2. Be sure to set the data type returned to "Yes/No"
    3. Be sure to uncheck "add to default view"
    4. IF you need to change the formula later, you will first have to recreate the "Today" column in step 1, modify the formula, save the formula, then delete the "Today" column.
  3. Delete the "Today" column
    1. This is needed for the "Today" value to be properly parsed in the above formula
    2. IF the "Today" column is not deleted, the formula using "Today" WILL NOT PROCESS CORRECTLY
  4. Create a new View and base it off the "All Events" view
    1. Select the columns you want to show, just accept the defaults
    2. Scroll down to the Filter section
    3. Set the filter to "RollingDateFilter" and set "is equal to" and set "Yes"
    4. Save the view
    5. You should now have a view that only shows 2 months out.
  5. Go to the homepage that has your un-filtered calendar view


    1. Edit the webpart
    2. Switch the view to "2MonthRolling" and save the changes

The results below

Posted in: Sharepoint  Tags: , ,
Tony Testa posted on March 4, 2009 18:30

I guess I can say that I was blessed and cursed all at the same time when it comes to work.  I was luck enough to be a consultant working on billable projects up until now, and not just 1 project but typically 2-3 at a time.  Finally it looks like I have a few weeks here to be only on 1 project and one that is easy and something I can tap on old resources and knowledge I've accumulated over the years.  That being said it means I now have a bunch of backlogged blog postings that i’ve been meaning to put up for everyone to hopefully save someone some headaches.

Upcoming postings:

  • Fix for errors that SharePoint throws regarding SharePoint’s licensed being “expired”
  • Ideas for how to programmatically create sites and assign permissions and issues related with the process
  • Workflow emails not being sent; what to look for, what to make sure is there in the first place
  • Using PSTOOLS to make managing a SharePoint farm easier
  • How to parse SharePoint IIS logs
  • Basic SharePoint troubleshooting techniques
  • SharePoint “terms of use” page
  • SharePoint Dev. tools you should be already using
  • SharePoint Web Service Gotchas
  • Why NOT to use server names when dealing with SharePoint
  • HowTo: Silverlight and SharePoint integration: Basic steps to get started
  • Programmatically set Search results page


Obviously from the list above I have a lot I’ve promised and a lot of live up to but I can assure you these have all been in the works for awhile so 90% of the work is done.  More to come…

Posted in: Sharepoint  Tags: , ,

Today while helping a colleague with a SharePoint solution I remembered about URL tokens that SharePoint can use.  I swore for the life of me that I had blogged about them but apparently I didn’t.  On that note…here it is.

To get straight to the point, SharePoint has certain URL tokens that it will read from a URL and in its processing, translate into the actual values.  According to the article on How to: Add Actions to the User Interface, the following tokens exist:

Windows SharePoint Services supports the following tokens with which to start a relative URL:

~site - Web site (SPWeb) relative link.

~sitecollection - site collection (SPSite) relative link.

In addition, you can use the following tokens within a URL:

{ItemId} - Integer ID that represents the item within a list.

{ItemUrl} - URL of the item being acted upon. Only work for documents in libraries. [Not functional in Beta 2]

{ListId} - GUID that represents the list.

{SiteUrl} - URL of the Web site (SPWeb).

{RecurrenceId} - Recurrence index. This token is not supported for use in the context menus of list items.

If you search the web for “SharePoint URL Tokens” you’ll find the same copied list.  The one thing that you won’t find most likely is the following article by Stefan Gobner, Stefan Gobners URL Tokens Posting.  Stefan is a MS Support Engineer which means that he works through these weird issues on a daily basis and he blogged about a few extra URL tokens/Querystring parameters that shouldn’t be used in your URLs.  According to Stefan, the following parameter names shouldn’t be used:

  • FeatureId
  • ListTemplate
  • List
  • ID
  • VersionNo
  • ContentTypeId
  • RootFolder
  • View
  • FolderCTID
  • Mode
  • Type

Luckily none of these stumped me in the past but certainly a few times I recall naming some “random” query string parameters and knowing that these “shouldn’t” be used would have been helpful.

(03/06/2009 UPDATE) A colleague of mine just mentioned I should add:

  • k

Reason for not using k is because the search queries use that.  I am going to navigate a sharepoint site in my sparetime and look for additional ones as well because I know search uses a few more as well.

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2017 Tony Testa's World