SharePoint 2010 Technical Guru – May 2013

SP2007-2010

Hello everyone,

Today I want to talk about a new series of community award bestowed by the team in charge of the TechNet Wiki. Since May, the authors of articles written during the month can be awarded with the title of “Guru” of the month for the technology.

The results of May were announced and I had the honor to receive the second and third prize for SharePoint 2010 category!

Résults are visibles here : http://blogs.technet.com/b/wikininjas/archive/2013/06/11/technet-guru-awards-may-2013.aspx

For more information on this competition, check here: http://social.technet.microsoft.com/wiki/contents/articles/17641.technet-guru-contributions.aspx

This competition is open to all, if you’re interested, you know what to do 🙂

Christopher.

Over 20000!

Hello everyone,

This one , I’ll talk about you.

I don’t know if you paid attention to the “Blogs stats” section of this blog (right column, in the bottom)  but we reached the 20000 hits milestone!

+10000 in 5 month!  I’m really happy of this. I’m also happy when I saw comments saying that this or htat post was helpfull, that’s why I do this!

Thanks also to the comment giving me advice to perfect my posts, any constructive comment is always appreciated.

Thanks to you all and see you soon for the next post!

Christopher.

CAML Query – Show element not assigned to me or my groups

SP2013

Hello everyone,

Some time ago, I made a summary post on « Filter on current user and current user groups »

This query uses the “membership” parameter to recover the current user groups. However, some time ago, a request was made on the msdn forums for reverse query! Namely, retrieve elements which are not assigned either to the current user or to one of its groups!

After doing several tests, I did not find any conclusive parameter and I turned to a solution of dynamic creation of the query.

Here it is


SPQuery query = new SPQuery();

query.Query = CreateQuery(web.SiteGroups);

.....

string CreateQuery(SPGroupCollection groups)

{

string queryToReturn = "<Where>";

int countAnd = 0;

List<string> listGroupName=new List<string>();

//Get list of group Name and count the number

foreach (SPGroup group in groups)

{

if (group.ContainsCurrentUser)

{

listGroupName.Add(group.Name);

countAnd++;

}

}

//If there is a least one group where the current user is in, we will need an 'And' and to add all the possibilities

if (countAnd > 0)

{

queryToReturn += "<And>";

for (int i = 0; i < countAnd - 2; i++)

{

queryToReturn += string.Format(@"<And><Neq><FieldRef Name='BelongsTo'/><Value Type='User'>{0}</Value></Neq>", listGroupName[i].ToString());

}

queryToReturn += string.Format(@"<Neq><FieldRef Name='BelongsTo'/><Value Type='User'>{0}</Value></Neq>", listGroupName[countAnd - 1].ToString());

for (int i = 0; i < countAnd  - 2; i++)

{

queryToReturn += @"</And>";

}

}

queryToReturn += @"<Neq><FieldRef Name='BelongsTo'/><Value Type='Integer'><UserID/></Value></Neq>";

//Close the And tag if needed

if (countAnd > 0)

{

queryToReturn += "</And>";

}

queryToReturn += "</Where>";

return queryToReturn;

}

Some explanations:

This function will do a check of all the groups in the collection, if the user is present in the group, a counter is incremented and the group name is saved in a list. Then the query is build based on those elements.

Hope this helps !

Christopher

Error – LegacyUIDetected

SP2013


Hello everyone,

Today I’ll talk about a thing to remember in a SharePoint 2007 to SharePoint 2013 migration.

If migrating a site is relatively fast and allows a similar rendering in SharePoint 2010 (off course I’m talking about an out of the box website), when you will migrate this site to SharePoint 2013, you will see during the execution of the Powershell “Test-SPContentDatabase” command the following error message
01
And yes, use the “magnificent” SharePoint 2007 branding is no longer possible with SharePoint 2013. As said by the message, you can either do the visual upgrade in your 2010 environment before migrating the database, or it will be done automatically during the migration.

Do not forget that if special branding exists on your 2007 environment, you will have to recreate it in case of migration.

Hope this helps.

Christopher.