Friday, March 26, 2010

Caching the PropertyBag in WSS3.0

For one of the req i have got the chance to go through the CKS code.Here i would like to onboard the code snippet.
The below code illustrates how to use Lock(),HttpRuntime.Cache and SPproperybag etc.
public class BlogSettings
{
private readonly object _Lock = new object();
private static readonly Cache Cache = HttpRuntime.Cache;
private SPWeb _CurrentWeb;
///
/// cached WebProperties
///

private readonly SPPropertyBag _WebProperties;
///
/// always create a new BlogSettings object to be able to store WebProperties
///

///
public BlogSettings(SPWeb oWeb)
{
_CurrentWeb = oWeb;
_WebProperties = null;
}
///
/// read BlogSettings from Cache. if the cache is not available, read blogsettings and store them in the cache (with sliding expiration).
/// this BlogSettings object is read only!
///

public BlogSettings(string url)
{
string webUrl = GetWebUrl(url);
string blogSettingsCacheName = string.Format("EBE{0}", webUrl);
lock (_Lock)
{
// try to get blogsettings for this webUrl from the cache
var blogSettings = Cache[blogSettingsCacheName] as SPPropertyBag;
if (blogSettings != null)
{
Trace.WriteLine("Using cached BlogSettings (webUrl=" + webUrl + ")");
}
else
{
// read blogsettings from web
Trace.WriteLine("Reading BlogSettings and store them in the cache (webUrl=" + webUrl + ")");
using (var site = new SPSite(url))
using (var web = site.OpenWeb())
{
var bs = new BlogSettings(web);
blogSettings = web.Properties;
int cacheTimeout = bs.PageOutputCacheTimeout;
Cache.Add(blogSettingsCacheName,
blogSettings,
null,
Cache.NoAbsoluteExpiration,
TimeSpan.FromMinutes(cacheTimeout),
CacheItemPriority.Normal,
null);
}
}
_WebProperties = blogSettings;
}
}

Tuesday, March 23, 2010

CKS:EBE Community website based on SharePoint

CKS:EBE2.0 has been availale on CodePlex.
CKS:EBE is a Feature?...Noooo...it is a huge application on WSS
The first thing to say about the CKS:EBE is that it is a feature, not a site template. Essentially this means that you can create a standard WSS blog site and use it, later you can add the EBE functionality if you want. This is very useful as it does not require you to make a decision about what type of blog you are going to use when you initially create the WSS site.
Every WSS developer should go through the code and analyze for Best practices.
It has been using for me while doing my current assignment.
This solution mainly focus the wss core things like features that contains all the pages, lists ,new columns,custom themes,storing Media files in Lists,HttpHandler and HttpModules,custom controls,braning files and lot of xsl needed for the EBE.

Sunday, January 17, 2010

More Pics on Winner Legue 09 function!

Winner Legue 09 function has happend on Nov09.
The actual link is
@http://naveedshare-licensetoplay.blogspot.com/2009/12/knowledge-champion-on-moss.html
I would like to add few pics on this board.




Thursday, January 14, 2010

SharePoint 2010 technical videos

The Channel 9 Learning Center is the destination for free technical training on MS Technologies.
Currently it has updated the portal with SharePoint2010.

Sunday, January 3, 2010

Validations on InfoPath2007?

I did two projects on Infopath2007 . I got the chance to work on high level info path object model and have played around one year on infopath surface.
I would like to post one of the simple screenshot which explain the validation of the form.

After reviewing related docs Supervisor group should change task status based upon errors.
In this screen shot based on Minor and Major errors(s) user should select the proper approval choice (COMPLETED, COVERWRAP, INVALIDXEMID, REJECTED, ALREADYAPPROVED, AWC, NOTSTARTED, FAILED and SUBMITTED etc).
These three controls would depend upon each other. I implemented rules to select proper options based upon severity else show error message on the form.