Albert Jan Schot
 

Editing pages with the SharePoint Designer 2010

24

Sep

So always nice to update a few minor things on a pagelayout using SharePoint Designer, especially if it has to be done quick, however this week I spend the first hour cursing why SPD wouldn't allow me to edit my pagelayout. Seems to be that opening it, checking it out isn’t enough. You have to press the advanced button…

Opening a pagelayout took a few minutes to get, due to the fact that in SPD2010 you have to click the ‘edit file’ after opening the file. Once you are in editing mode all the html in code view is a bit yellow though, and not editable. To get it editable you have to click the Advanced mode button, after doing so you will be able to edit your page as like. However once you clicked it, it will grey out..

 

image

Albert-Jan Schot schreef

Comments (0)

Albert-Jan Schot

How to generate XML for Colligo

18

Jun

Colligo allows you to sync SharePoint lists and libraries to your computer, and since Office 2003 won’t recognize memberships pulled from a SharePoint 2007 environment by default, one of your customers choose this tool to have a save-as functionality option in Office 2003. The idea was to auto generate the xml file that is readable by Colligo so each user would have a set of sites to save to.

First things first, the documentation on how you can create such an xml file can be found here  and a demo xml file can be found here (xsd can be found here). Knowing that makes it pretty easy to generate the xml you require. Two things to keep in mind:

  • Don’t use comments in your XML file, Colligo just won’t import it.
  • If you auto generate the xml multiple times, make sure to delete the file after Colligo imported it, otherwise it tries to import it again (and fails) the next time you start Colligo

So creating XML files for Colligo made easy.

Albert-Jan Schot schreef

Comments (0)

Albert-Jan Schot

UserProfile and ChoiceLists, reading and saving

19

Feb

Last few days I have been struggling with a piece of code that should update a UserProfile. The idea was to make a nice feature that allows a WebPart to display a link that would open a screen showing the user some options to change UserProfile values. Those change options should be rendered based on three pieces of information; a Site Column containing possible values, a ControlType and the UserProfileProperty to save it to.

The first few versions worked pretty well since I only had to save strings or checkboxes, however further along the way I decided that ChoiceLists from the UserProfile should be supported, and there it all went wrong, even with Google it took me quite some time figuring out how to do it, so here a few tips: 

Saving a single value to a UserProfileProperty even when its a ChoiceList is pretty easy:

    userprofile[item.Key].Value = item.Value;

Saving multiple values to a userProfileProperty took me some more time, but finally even that appeared to be possible:

   foreach (string choice in choiceList)
   {
      userprofile[item.Key].Add((Object)choice);
   }

Minor detail on that part appeared that the .add option does as it says, it only adds items; ergo if you would already have selected option1 in your profile, and try to update it with an option2, it would keep the option1 saved, and adds the option2.

So before you are actually try to save values that way do a:

   userprofile.clear();

   userprofile.update();

Now that’s for ‘saving’ values to your UserProfile, reading them is another story, reading a ‘normal’ string can be done with a simple:

   userprofile["PropertyToRead"].Value;

Reading a ChoiceList should be done like:

   if (userprofile["PropertyToRead"] is UserProfileValueCollection)
            clValue = userprofile["PropertyToRead"] as UserProfileValueCollection;

Whenever you done that you can simple loop trough the UserProfileValueCollection for reading the selected items.

Albert-Jan Schot schreef

Comments (0)

Albert-Jan Schot

SharePoint: The security validation for this page is invalid

08

Jan

Today I found myself running into the ‘famous’ “The security validation for this page is invalid” error and it cost me quite some stress figuring out what went wrong, and why I wasn’t allowed to do what I wanted, a simple change to a user profile.

The thing is that everything worked fine, until I actually added the UserProfile.Commit() to apply the changes to my profile. So after some searching the web for something that could help me further (besides the run with elevated privileges), and some help from my colleague Peter we found the following article: The security validation for this page is invalid.

Basically the idea is: forget the AllowUnsafeUpdates(); and add a FormDigestControl to the page you are working on, as you can see it only takes a reference: 

<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

And a control:

<SharePoint:FormDigest runat=server/>

Further info can be found on the mentioned blog.

Albert-Jan Schot schreef

Comments (0)

Albert-Jan Schot

Exporting Site Columns

11

Dec

If you ever want to export site columns from an existing site collection, you might find yourself in a bit of a loop, since its quite hard to get a nice ‘export’ of all those columns if your no developer. So when I found out Gary had done that before I thought it was worth a blog.

Just some plain information about ‘exporting’ site columns from an existing site collection:

http://stsadm.blogspot.com/2008/02/export-site-columns.html 

The actual download can be found here:

http://stsadm.blogspot.com/2009/02/downloads.html

I did blog before about them extensions and the use of them in case of Ghosting.

Albert-Jan Schot schreef

Comments (0)

Albert-Jan Schot
Page 1 of 5 in the tipstricks category Next Page