Sunday, October 5, 2008

Tuesday, September 23, 2008

SPPropertyBag

SPWeb object of SharePoint exposes a Field called Properties which is of type SPPropertyBag a sub class of StringDictionary. It allows you to store Key value String Data within a web

Below are some quick points that will help you in using it.

  • As Mentioned Before it is a StringDictionary, which can only store String values.
  • You need to call the Update() method of the SPWeb.Properties.Update() to persist the value.
  • Same applies while you are removing a value from it.
  • Below code gives you a quick start.
  • If you want to manage this through UI. Refer this link. It's a fantastic option you will love.


 

using (SPSite oSite = new
SPSite("http://mysite"))

{


using (SPWeb oWeb = oSite.RootWeb)

{


//Add a Item to Bag

oWeb.Properties.Add("SPPropertyBag","I can Store a StringValue Here");


//Be sure to Call the Update Method on Properties


//If you miss this your value wont get Presisted for the Next Run

oWeb.Properties.Update();


 


// To Reterive the Value


String sMyItem = oWeb.Properties["SPPropertyBag"];


 


//Remove the Value


//Be sure to Call the Update Method on Properties


//If you miss this your value wont get Presisted for the Next Run

oWeb.Properties.Remove("SPPropertyBag");

oWeb.Properties.Update();

             }

         }

    

    

Friday, September 19, 2008

Deploying InfoPath forms using Features – the Right Way

Same version of the Post is avaliable in this Link. Formatting Adjusted.

A week back couple of my friends was asking is there a proper way to deploy the InfoPath forms to the server, Way other than File -> Publish - > SharePoint server with or without forms server. I did a quick search and was not lucky, came to a lackadaisical conclusion that there is no other way. But whenever I deploy workflows with InfoPath form I see a new solution that adds itself to the Solution Store. By this I know for sure there is some other way to deploy InfoPath forms. First thing want I wanted was to get the Solution out of SharePoint and see what's there inside, Again for this there is a tool through which you can do it [I lost the url from where I got it] or hardly 10 lines of code is all what you need.

To my surprise there is indeed a way to do it, well let's see how. What I got out of that solution is a feature, what's in it [Image speaks louder than words, image with comments even louder ;) ]

Feature.xml

#########All usual Stuff ###########

<?xml
version="1.0"
encoding="utf-8"
standalone="yes"?>

<Feature
Id="8ad77502-3602-6e81-c4de-8c7f674c4466"

Title="IPDeplotyment"

Description="$Resources:ipfscore,XsnFeatureDescription;"

Version="1.0.0.0"

Scope="Site"

DefaultResourceFile="ipfscore"

#########Here is the hero who does what we need ###########

ReceiverClass="Microsoft.Office.InfoPath.Server.Administration.XsnFeatureReceiver"

ReceiverAssembly="Microsoft.Office.InfoPath.Server, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"

xmlns="http://schemas.microsoft.com/sharepoint/">

<ElementManifests>

<ElementManifest
Location="Elements.xml" />

<!-- Name of the IP Form

Note:Actual workflow generated feature has a different name-->

<ElementFile
Location="solution.xsn" />

</ElementManifests>

<Properties>

<!-- The Name of the Feature - Infact after you have deployed the WF to sharepoint there will be a

feature by this name that gets added -->

<Property
Key="FeatureName"
Value="FT-01-8ad77502-3602-6e81-c4de-8c7f674c4466" />

<!-- This is going to the File name with which you have Publised from IP Client / Added to the Workflow.xml

if you are going to deploy the IP forms that are not coupled with the WF you can safely ignore the below tag-->

<Property
Key="OriginalFileName"
Value="IPDeplotyment.xsn" />

</Properties>

<ActivationDependencies>

<!-- Just to make sure that you have Enterprise feature turned on-->

<ActivationDependency
FeatureId="C88C4FF1-DBF5-4649-AD9F-C6C426EBCBF5" />

</ActivationDependencies>

</Feature>

Element.xml

################### You are Right its again another File Provisioning in to SharePoint Lib #####################

<?xml
version="1.0"
encoding="utf-8"
standalone="yes"?>

<Elements
xmlns="http://schemas.microsoft.com/sharepoint/">

############# Be sure to put the location as FormServerTemplates############

<Module
Name="XSN"
Url="FormServerTemplates"
RootWebOnly="TRUE">

<File
Url="solution.xsn"
Name="IPDeplotyment.xsn"
Type="GhostableInLibrary" />

</Module>

</Elements>

Well here is the stripped out version of the above file

<?xml
version="1.0"
encoding="utf-8"
standalone="yes"?>

<Feature
Id="8ad77502-3602-6e81-c4de-8c7f674c4466"

Title="IPDeplotyment"

Description="$Resources:ipfscore,XsnFeatureDescription;"

Version="1.0.0.0"

Scope="Site"

DefaultResourceFile="ipfscore"

ReceiverClass="Microsoft.Office.InfoPath.Server.Administration.XsnFeatureReceiver"

ReceiverAssembly="Microsoft.Office.InfoPath.Server, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"

xmlns="http://schemas.microsoft.com/sharepoint/">

<ElementManifests>

<ElementManifest
Location="Elements.xml" />

<ElementFile
Location="IPDeplotyment.xsn" />

</ElementManifests>

<Properties>

<Property
Key="FeatureName"
Value="FirstIPFeatureWayDeployment" />

</Properties>

<ActivationDependencies>

<ActivationDependency
FeatureId="C88C4FF1-DBF5-4649-AD9F-C6C426EBCBF5" />

</ActivationDependencies>

</Feature>

Element.xml

<?xml
version="1.0"
encoding="utf-8"
standalone="yes"?>

<Elements
xmlns="http://schemas.microsoft.com/sharepoint/">

<Module
Name="XSN"
Url="FormServerTemplates"
RootWebOnly="TRUE">

<File
Url=" IPDeplotyment.xsn"
Name="IPDeplotyment.xsn"
Type="GhostableInLibrary" />

</Module>

</Elements>

Steps in Short:

  • Develop your IP form.
  • Publish it to the network location as how you do to upload to the Central Administration Upload Form Templates.
  • Create one Feature.xml, Element.xml as defined in the article [Sorry how workflow does ;)].
  • Put in the IP form and create a feature out of it.
  • Its all.

Wednesday, September 17, 2008

SharePoint Tools

Below is the List of the SharePoint tools that will boost your productivity. I love them and use them. You too will...

Writing CAML Queries directly in C#.

CAML.NET     http://codeplex.com/camldotnet

Custom STSADM command and Command to Get the Content Type Xml Schema

CUSTOM STSADM http://www.andrewconnell.com/blog/articles/MossStsadmWcmCommands.aspx

SQL like CAML Queries - My Favorite one

CAML Queries in SQL Syntax http://www.ideseg.com/SharePointYetAnotherCAMLQueryTool2.aspx


 


 


 

SharePoint Permission Dependency Chart

This Image speaks for Itself .. If you want more Visit this link.


Adding Server Side code to the Publishing Page Layouts - PageParserPaths

This article is to give a brief introduction for the Functionality of PageParserPaths tag in the Web.Config file of SharePoint. (It serves as a Reference for me In future and for someone out there looking for a similar implementation).

All the Layout pages in the SharePoint 2007 are derived from the class

Microsoft.SharePoint.Publishing.PublishingLayoutPage .

This works very well for most of the cases and customization. But there will be very chance that for some reason you want the actual page instance to have a completely different class. Might be a case where you are using a third part tool or a component. In this case if you try to change the base class or put in some custom server side code in to the page layout file, SharePoint will complain you with a parser error.

This Article describes the approach that will help you to put in the code for the layout pages. It works like charm.

On additions to the above article is that in case if you are concerned about allowing all the pages having the server code as defined by below tag

<PageParserPath VirtualPath="/_layouts/masterpage/*" CompilationMode="Auto" AllowServerSideScript="true"

IncludeSubFolders="true"/>

You can make a particular page to have server side code as below

<PageParserPath VirtualPath="/_layouts/masterpage/yourpage.aspx" CompilationMode="Auto" AllowServerSideScript="true"

IncludeSubFolders="true"/>

While configuring a single page, make sure that you remove the attribute IncludeSubFolders="true". If you leave this tag as it is, all you are going to get is a plain HTTP 500 error code which is hard to debug. Validation that SharePoint makes here is IncludeSubFolders="true" can be present only if the attribute VirtualPath ends with /*.

Wednesday, August 27, 2008

SQL Server and SQL Reporting Server SSRS - Quick Reference –FAQ’s

SQL Server

  1. Add a Database user to a Database role:
    EXEC sp_addrolemember 'db_owner', 'yourdbusername'
    More here
    http://technet.microsoft.com/en-us/library/ms187750.aspx?PHPSESSID=rr1g5nuj29l79hrpjk7k0g1461
  2. When you rename the SQL Server name:

In case if you have renamed the SQL Server recently and find a trouble to connect to the server using code. Try the below items.

  • Use Query Analyzer and Connect to the SQL Server.
  • Execute the command SELECT @@SERVERNAME AS 'Server Name'
  • You will find the old name reflecting there.
  • First run the command sp_dropserver 'old server name'
  • And then run sp_addserver 'new server name', 'local'
  • You should be good to go

SSRS Reporting Servers:

  1. To change the User Name or the Server name of the Reporting Server instance [SSRS].
  2. When you get rsreportserverdatabaseunavailable error when connecting to SQL Server Reporting server.

For the above case you have to use the tool rsconfig that will change the user and server details.

http://msdn.microsoft.com/en-us/library/ms162837.aspx

Tuesday, August 19, 2008

Unable to Create new SSP – Created new Web Application not getting listed in the list.




When you try to create a new SSP you might run in to surprise that the newly created web application will not get listed in the list web application of new SSP page.
One quick check you need to perform in this case is to check the App Pool account of the Web Application. If it is Network Services then that the issue. You can find the answer in same New Shared Services Provider page.






J

Monday, August 18, 2008

SharePoint – Quick Help Commands!!!

Process ID for the Web Application:

While debugging SharePoint application mainly SharePoint Workflow you will need to find the Process ID of the Web Application you are trying to Debug. If each of the web application runs in same user account its tough to find the same.

Run the below command that will list all the Application Pool and Its Process ID

c:\windows\system32\cscript.exe c:\windows\system32\iisapp.vbs

Run To access STSADM from any directory in command Prompt:

Add the 12Hive\Bin path to the Windows Environment PATH Variable.

More: Here

Tuesday, July 29, 2008

InfoPath Form Services 2007

It was hard for me to understand how the InfoPath form services licensing work and how it is related to SharePoint server 2007 (MOSS 2007). I stumbled to find the link "Manage InfoPath Form Templates" in my local Development environment which is a Standard SharePoint CAL installation. Today I Googled it and managed to get few information regarding it.

  • We know that InfoPath can be viewed in the browser without InfoPath Client.
  • How? Well InfoPath Form Services help you to render the InfoPath form in the Browsers without InfoPath client installed in your machine.
  • You can get the InfoPath Form Services in two ways (Assuming that you have a Standard SharePoint 2007 Installation or WSS 3.0 Installation).
    • Buy a License for Microsoft Office Forms Server 2007 and install it in your SharePoint / (WSS 3.0) Server Farm. [This is the only option in case if you have the WSS 3.0 Installation]
    • Upgrade your SharePoint Server farm to the Enterprise License. [Form Services Features are supported in Enterprise Version].

If you still want to get confused more J . Please refer to the below links that give you the information on the various SharePoint licensing favors.

http://office.microsoft.com/en-us/formsserver/FX101865111033.aspx http://littletalk.wordpress.com/2008/02/07/where-is-infopath-forms-services-section/
http://littletalk.wordpress.com/2008/04/24/this-form-template-is-browser-compatible-but-it-cannot-be-browser-enabled-on-the-selected-site/

Friday, June 27, 2008

EnableViewState=”false”

In most of the application we develop one way or the other we display information to the user stating the result of the operation that was just invoked.

  • In particular with ASP.NET we frequently use the Label / Literal control to display the information in the page.
  • Once the information is displayed to the user on the subsequent operation we use to clear the Label message that was displayed.
  • We do this mostly in the Page_Load event.
  • By any chance if we overlook it, old message will confuse the user.
  • One quick trick to solve this problem is to set the EnableViewState attribute of the Label /Literal control to false.
  • By this ASP.NET won't persist the previously displayed information and whatever message we want to display will be visible only one time.


I found this some of the page in SharePoint. Thought of sharing!




Thursday, April 24, 2008

Comparing two SPUser in SharePoint

Recently I was working on an EventHandler, Where I have to compare the User value in the Assigned To Field of the List with the other User value. Went down to Google and couldn't find exact code I am looking for, here is the exact code that will do this.


 

SPUser spUser = GetSPUserOne();

SPUser spPrevUser = GetSPUserTwo();

For Windows Authentication This will do


 

if(spUser.Sid.Equals(spPrevUser.Sid))

{

…..

}

For FBA you have to follow this


 

if(spUser.UserToken.CompareUser(spPrevUser.UserToken))

{

…..

}


 

Hope this helps someone like me

Monday, November 12, 2007

My First Blog Post from the Word 2007

Hello … This is the First Post I tried out with the Word 2007…. It really easy…

and It rocks… If you want to give it a try ..

Follow the links below

http://office.microsoft.com/en-us/word/HA101640211033.aspx

Happy Blogging !!!!!!!!!

Friday, October 5, 2007

ASP.NET 2.0 AJAX InlineEditLabel Control

Try out the New Control

ASP.NET 2.0 AJAX InlineEditLabel Control

Office SharePoint Server Deployment Plan sample

Ever wished you just had a sample project plan that you could then modify for your own use? I’m sure this comes up on occasion.

refer to this link
moss mpp

Thursday, October 4, 2007

RequiredFieldValidator + OnClientClick issue

This is one of the common issue that everyone face in day to day ...
refer the below link this gives you a good solution that really works...

requiredfieldvalidator & onclientclick

Happy programming!!!!!!!

Wednesday, October 3, 2007

.Net framework Source Code.

its Gona rock...it will help all the developer to debug with ease,understand the framework and to code better...


Find more Scottgu Message : Framework Source Code

Monday, November 27, 2006

Disable My Site link in MOSS 2007.

This post helps you to disable the My Site Link that is at the top of SharePoint site based on the rights of logged in user.

Open the Shared Services Administration Link from the Central Administration page.





In the Manage shared service page select the shared service to which your site for which you need to manage the My Site Link is mapped.In the below fig I am trying to manage My Site Link for Site SharePoint - 6000,So I am selecting the SharedServices1.























In the Shared Admin page select the link Personalization Services Permissions Link present in the User Profiles and My Sites Section.










Select the user group for which you want to enable or disable the My Site Link Permission.







Check or Uncheck the Create Personal Site Check box to Manage the Rights

Sunday, November 26, 2006

Enable Usage Analysis Processing in MOSS2007

Enabling the Usage analysis process in the V3.0 is quite different from V2.0 and here is the steps to enable the same.

Open Central Administration page of the SharePoint Server and Click open the Operations tab.


In the Operations Tab click open the link "Usage Analysis Processing " in the section Logging and Reporting .











In the usage Analysis Processing Check enable the Check Box "Enable Logging ".

Set log file location and Number of log files to be created [ Note:If the Log file location is changed from default value then there are few additional steps needs to be followed to provide sharepoint server the rights to read,write and delete the files from that folder.]

Check enable the "Usage analysis Processing" check box and set the time that you like the server to process these files.











Click open the central admin page and select Shared Service Administration Link.














In the Manage shared service page select the shared service to which your site that needs be enabled for usage analysis is linked.In the below fig I am trying to set the usage analysis for the SharePoint - 6000,So I am selecting the SharedServices1.









Open the shared Admin page as below









In the Shared Admin page select the link Usage Reporting under the section Portal Usage Reporting












In the configure Advanced Usage Analysis processing Check enable the Enable Advanced Usage analysis processing.
Once done you can access the Report from Usage Report Link from the SiteSetting page of your site.Please note that the In order to get to view the report data you should allow the site for a day thus enabling it to get the sufficent data for the report.