Thursday, December 23, 2010

Display an exchange public calendar inside sharepoint

To display an Exchange public calendar inside a sharepoint page use a pageviewer webpart, and choose the url this way
https://your_exchange_server/owa/?cmd=contents&module=PublicFolders&f=Calendar
(don't use that kind of url , https://your_exchange_server/public/Calendar/?view=monthly, you may have access is denied error )

Friday, July 30, 2010

Sharepoint 2010 - Create an Audience based ACL

I have been asked to manage the security of an application according to the user profile organization's property.... Well obviously, sharepoint is not designed like that. So, how to ?

My solution is the following :
  • Fill the organization property on each of the profile
  • Create one audience per organization based on this property
  • Synchronize the audiences with Sharepoint groups using a timer job (that's the main part of the article)
I won't explain the two first points, I guess you already know how to create and compile audiences, else go back to the root first !

The principle of my timer job is simple. It is activated using a feature that is scoped webapplication. The execute method parses all the sites of the applications, and the audiences of the platform. It thus verify that a group with the same name exists on the site. If not, it creates the groups, If it does exist, it just adds the users in the group.
So at the end I have on all my sites, the same groups with the same users and everything is based on the audiences that are based on the user profile properties ... Quod Erat Demonstratum.

Below the execute Method of the Timer job:

try
{
SPWebApplication webApplication = this.Parent as SPWebApplication;
AudienceManager audManager = new AudienceManager(SPServiceContext.GetContext(webApplication.Sites[0]));
foreach (SPSite site in webApplication.Sites)
{
foreach (Audience au in audManager.Audiences)
{
try
{
if (site.RootWeb.SiteGroups[au.AudienceName] == null)
{
}
}
catch (Exception exx)
{
SPUser oUser = site.RootWeb.Users.GetByEmail("alexandre.joly@toto.com");
SPMember oMember = site.RootWeb.Users.GetByEmail("alexandre.joly@toto.com");
site.RootWeb.SiteGroups.Add(au.AudienceName, oMember, oUser, "Group synchronized on existing audience");

}
SPGroup group = site.RootWeb.SiteGroups[au.AudienceName];
ArrayList members = au.GetMembership();
if (members != null)
{
foreach (UserInfo userInfo in members)
{
group.Users.Add(userInfo.NTName, userInfo.Email, userInfo.PreferredName, "");
}
}
}
}

}
catch (Exception exc)
{

}

Thursday, June 24, 2010

Migrating Sharepoint 2010 Beta to RTM

As most of you may have seen... migrating Beta to RTM is not something supported by MS. Of course, we all understand that the corrected bug of the beta may cause problem on you newly installed flashy RTM Platform... BUT... some of us (at least me) have been asked to put in production a beta platform... and now.. with 10000 items in a list... what can I do ? hiring 100 persons to recreate my items ... obviously not So let's find a way..

  1. Using the Backup site collection feature in the central admin on your beta platform, back up the entire site collection that contain you web or you list (dont try to' export only list or webs using powershell commands, it simply doesn't work (version conflicts).
  2. Using the restore-spsite powershell command to restore your site collection on your new platform...
  3. Yessss! Now you have you data on you new platform.. YESSSSS, it feels already better... (OOOH Damned.. I have lost my term store connection, arrrg)
  4. use the Content deployment wizard tool of Cris O Brien (Sharepoint MVP) to migrate content from your site collection to your new site. In my case I only had to migrate 3 big lists with content types.
in my case, I had to launch several other scripts to resolve my term store connection problem (I parse my old list to find the termstores values and I pars my new list to put back those values....)
I'm sure it can work without doing that but I didn't find the way !


Good luck

Monday, March 1, 2010

Sharepoit 2010 - Search service application

One of the multiple evolutions of the last version of Sharepoint upon the last one is how Sharepoint manages the different services.

Bye bye Shared Service Provider (SSP), Hello the Services applications.

The management of those applications is accessible via the "manage Service applications" of the central admin page.
Yesterday I had a super search app that was working fine with all my scopes and metadatas. Sounded good, no?
Obviously, it's when things go the best that some ununderstandable sh.t happens... In my event viewer, from yesterday nigth til now and every minutes, I had a message saying that my crawl DB wasn't accessible. Damned What have I done??
So as a solution I tried to reset all my indexes... Nope..
I then tried to detach and attach the Search App db... Nope...
I finally decided to save all my settings and to delete my search application (and all the DBs and to recreate it (I'd rather take 1h to do this instead of asking myself the all day "what the fuck wht the fuck"

Here I am now... I can't create a search application : the form opens asking me the app pools and the account , and after a minute and 31 seconds... I have this error

"
Errors were encountered during the configuration of the Search Service Application.
System.Data.SqlClient.SqlException: User does not have permission to perform this action. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at Microsoft.Office.Server.Data.SqlSession.ExecuteNonQuery(SqlCommand command) at Microsoft.Office.Server.Data.SqlServerManager.GrantLogin(String user) at Microsoft.Office.Server.Search.Administration.SearchDatabase.GrantAccess(String username, String role) at Microsoft.Office.Server.Search.Administration.SearchDatabase.SynchronizeAccessRules(SearchServiceApplication searchApp) at Microsoft.Office.Server.Search.Administration.SearchServiceApplication.SynchronizeDatabases() at Microsoft.Office.Server.Search.Administration.SearchServiceApplication.Provision() at Microsoft.Office.Server.Search.Administration.SearchConfigWizard.b__22() at Microsoft.Office.Server.Search.Administration.SearchAdminUtils.UpdateIgnoreSPUpdatedConcurrencyException(String description, SearchAdminUtilsUpdateDelegate updateDelegate, SearchAdminUtilsRefreshObjectDelegate refreshObjectDelegate) at Microsoft.Office.Server.Search.Administration.SearchConfigWizard.CreateSearchApp() at Microsoft.Office.Server.Search.Administration.SearchConfigWizard.ProvisionSearchServiceApplication() at Microsoft.Office.Server.Search.Administration.SearchConfigurationJobDefinition.ExecuteTimerJob()
"

Ooupppppps, so... so far.... no search service for my users :-/

Mmmm, let's check what could have happened ...
This line is interesting "
Microsoft.Office.Server.Data.SqlSession.ExecuteNonQuery(SqlCommand command) at Microsoft.Office.Server.Data.SqlServerManager.GrantLogin(String user) "

Am I having SQLServer secrutiy troubles??
If I check the security settings in SQL Server on my staging environment and on my production environment I notice that my service account on my production environment doesn't have the "SecurityAdmin" right ... DAMNED ! I GOT YOUUUUUUU !!

Retry...
YESSSSSSSSSS !


Wednesday, January 27, 2010

Term Store and views

After a 2 months using sharepoint 2010 every days, I have extracted in this new version a wonderfull feature : the term store. It allowed us to simplify a lot the architecture.

Now, the list of customers and projects to which the data is linked all around the information system is tagged using termsets. Easy to create, easy to maintin.

Before I had to create linked list to simulate the hierarchy... now, everything is done my itself.

I won't make a all blog on this feature, some other blogs already did it :
http://www.wssdemo.com/Blog/Lists/Posts/Post.aspx?List=b853926a-b04e-4620-94e4-88a5d56cb262&ID=494&Web=d47402ad-1767-42ba-a072-133479a9bb5a
or
http://www.cmswire.com/cms/document-management/overview-sharepoint-2010-metadata-and-taxonomy-management-006015.php


One bad point though... This morning I wanted to create views grouped by my customer column (which is a managed metadata column), How disappointing it was when I noticed that It was simply impossible :( Those kind of column don't appear in the list.

So be aware that grouping and sorting is not available for Managed metadata columns.