Tuesday, June 21, 2011

Sharepoint 2010 : Deploying a WSP package to remote server easily

By using Sharepoint Management Console,

1) Uninstall-SPSolution -Identity package.wsp -WebApplication http://server
2) Remove-SPSolution –Identity package.wsp
3) Add-SPSolution "C:\blabla\package.wsp"
4) Install-SPSolution –Identity PernodTC.wsp –WebApplication http://server


Monday, June 20, 2011

CAML & C#

If you are querying a Sharepoint 2010 List with CAML using C#, sometimes you can face inconsistent results. One of the most popular ones is not working OrderBy statements. After querying the list in C# with OrderBy query, you may see that the incoming list is still in default order.

The solution here is simple: In case you are using Query tag in your query string, just remove it. Your querystring should start directly with Where or OrderBy tag and this should solve your problem.

If it still does not, you can add Type field to your OrderBy query. Type="Number" or Type="DateTime" helps CAML interpreter to understand howto sort it. (Well, it should automatically detect it from Sharepoint therotically, yes, but the real life is never easy in Sharepoint)

The last thing in your checklist can be that CAML is a case-sensitive language, you can think about checking your query syntax and capital letters.

Wednesday, June 1, 2011

Sharepoint 2010 and Session

Hello everybody,

It's a known thing that it's not that easy to start working with Sessions when developing custom webparts. It demands several modifications on server etc.

If you have jumped over that issue, you may face further ones about storing objects in Session.
One of the key elements here is being "Serializable" Even depending on your configuration, Sharepoint may allow you to use non-serialiazable classes in session or not.

But if you're facing "unknown error" in your session-using custom webpart, take a look at your session objects and be sure that all of them are serializable ones.

(You can define your all classes with [Serializable] attribute, by the way.)