I've started to write a piece on What is Code Access Security in SharePoint 2007 and thought I'd put the draft up here to get some feedback -- especially since configuring security has taken prominent place. I'd really appreciate all of your feedback. Thanks! Hament
These days, you can't pick up a blog without reading about the need for the customizing SharePoint as per need of organization. Most of these are done via setting configuration and some time by custom programming too. We as programmer need to think carefully before tweaking the setting for WSS_Minimal and WSS_Medium trust levels. In exceptional cases a third configuration ‘Full’ can also be set. Let me warn you here that this may have serious implications and you may not be able to convince the security group to deploy it in production boxes.
Earlier the security were declared in the web.config file, but that doesn't seem to be the case any more. You will find two pointers to config file of folder localdrive:\program files\common files\microsoft shared\web server extensions\12. The classes are configured for code access level. For example you will find out that SqlClientPermission are not allowed in WSS_Minimal but is allowed in WSS_Medium trust.
Saturday, August 30, 2008
Wednesday, August 27, 2008
Extending OCS
Tuesday, August 26, 2008
STSDEV: Sharepoint Code generator
STSDEV is a proof-of-concept application that demonstrates a simple code generator for create SharePoint 2007 development projects targeting Visual Studio.
http://www.codeplex.com/stsdev
http://www.codeplex.com/stsdev
Monday, August 25, 2008
Find Permission and perform action based on Admin access
Find Permission
SPWeb thisweb = SPControl.GetContextWeb(Context);
isAdmin = thisweb.DoesUserHavePermissions(SPBasePermissions.ManageLists);
if (isAdmin == true)
{
// todo
}
SPWeb thisweb = SPControl.GetContextWeb(Context);
isAdmin = thisweb.DoesUserHavePermissions(SPBasePermissions.ManageLists);
if (isAdmin == true)
{
// todo
}
Sunday, August 24, 2008
Setting URL of link Programatically
SPList list = web.Lists["Links"];
SPListItem newLink = list.Items.Add();
SPFieldUrlValue value = new SPFieldUrlValue();
value.Description = "test";
value.Url = "http://www.microsoft.com/sharepoint";
newLink["URL"] = value;
newLink.Update();
SPListItem newLink = list.Items.Add();
SPFieldUrlValue value = new SPFieldUrlValue();
value.Description = "test";
value.Url = "http://www.microsoft.com/sharepoint";
newLink["URL"] = value;
newLink.Update();
Diaplaying Link field in ItemStyle
< name="LinkList" match="Row[@Style='LinkList']" mode="itemstyle">
< name="DisplayTitle">
< name="OuterTemplate.GetTitle">
< name="Title" select="@URL">
< name="UrlColumnName" select="'URL'">
< /xsl:call-template>
< /xsl:variable>
< name="LinkTarget">
< test="@OpenInNewWindow = 'True'"> _blank< /xsl:if>
< /xsl:variable>
< id="linkitem" class="item">
< class="bullet link-item">
< name="OuterTemplate.CallPresenceStatusIconTemplate">
<>
< name="href">
< select="substring-before($DisplayTitle,', ')">
< /xsl:value-of>
< /xsl:attribute>
< name="title">
< select="@Description">
< /xsl:value-of>
< /xsl:attribute>
< select="substring-after($DisplayTitle,', ')">
< /xsl:value-of>
< /a>
< /div>
< /div>
< /xsl:template>
< name="DisplayTitle">
< name="OuterTemplate.GetTitle">
< name="Title" select="@URL">
< name="UrlColumnName" select="'URL'">
< /xsl:call-template>
< /xsl:variable>
< name="LinkTarget">
< test="@OpenInNewWindow = 'True'"> _blank< /xsl:if>
< /xsl:variable>
< id="linkitem" class="item">
< class="bullet link-item">
< name="OuterTemplate.CallPresenceStatusIconTemplate">
<>
< name="href">
< select="substring-before($DisplayTitle,', ')">
< /xsl:value-of>
< /xsl:attribute>
< name="title">
< select="@Description">
< /xsl:value-of>
< /xsl:attribute>
< select="substring-after($DisplayTitle,', ')">
< /xsl:value-of>
< /a>
< /div>
< /div>
< /xsl:template>
Saturday, August 23, 2008
Surveys Add questions.
Surveys Add questions programatically
SurveysSPListTemplate objTemplate = currentWeb.ListTemplates["mySurvey"];
Guid objGuid = currentWeb.Lists.Add("mycode", "survey", objTemplate);
SPList objSurvey = currentWeb.Lists["mycode"];
//Let’s add questions
StringCollection strQuestions = new StringCollection();
string strQuestion = "What is your favrate colour?";
strQuestions.Add("Red");strQuestions.Add("Blue");
strQuestions.Add("Green");
objSurvey.Fields.Add(strQuestion, SPFieldType.Choice, true, false, strQuestions);
objSurvey.AllowMultiResponses = false;objSurvey.Update();
Friday, August 22, 2008
Preformance Optimization in SharePoint Server 2007
Several areas we have to look here.
1) Delayloading of core .js
You can load it conditionally. Optimizing core.js
2) Browser Cache Settings
You can look here
1) Delayloading of core .js
You can load it conditionally. Optimizing core.js
2) Browser Cache Settings
You can look here
Sample event handler to set field as primary field
Use SPItemEventReceiver to achive same. Query the list, find out item with same title, if present set the cancel property to be true.
see here
see here
Thursday, August 21, 2008
Programmatically retrieve the items in a list based on the current user
Based on the permissions of individual user by using SPQuery. more details here
Subscribe to:
Posts (Atom)