Skip to main content

Posts

Showing posts from June, 2009

Filtering a SharePoint View from the QueryString

You can filter the contents of a SharePoint list view by appending a couple of querystring values to the address. For example, if you have a list view including a field named "DocumentID", you can filter a preset list view to only show items for a Documents with ID "123" by adding the following querystring to the page URL: ?FilterField1=DocumentID&FilterValue1=123

Populate set or get data value from to hyperlink column

Data in the Hyperlink Column can be populated / set in the following manners: Item[“HyperLinkColumnName”] = “http://www.google.com, Google”; Item.Update(); Don’t forget space after comma. Or SPFieldUrlValue MyURL = new SPFieldUrlValue(); MyURL.Description = “Google”; MyURL.Url = http://www.google.com ; Item[“HyperLinkColumnName”] = MyURL; Data from the Hyperlink Column can be get in the following manner: SPFieldUrlValue MyURL = new SPFieldUrlValue(Item[“HyperLinkColumnName”].ToString()); string URLText = MyURL.Description; string URL = MyURL.Url

Programmatically Adding Users and Groups to SharePoint List Item

SPSite WebApp = new SPSite(SitePath); SPWeb Site = WebApp.OpenWeb(); Site.AllowUnsafeUpdates = true; SPList TaskList = Site.Lists["PAQA Tasks"]; SPListItem NewTask = TaskList.Lists["PAQA Tasks"].Items.Add(); SPFieldUserValueCollection fv = new SPFieldUserValueCollection(); SPUserCollection usrColl = grpApprovers.Users; foreach (SPUser grpUser in usrColl) { // add the new user into the collection fv.Add(new SPFieldUserValue(Site, grpUser.ID, grpUser.Name)); } NewTask["Assigned To"] = fv; NewTask.Update();

SharePoint 2007 Maximum Limitations

Following is a list of names and other parameters with the maximum allowable size on each. Entity Max Permissible Size Site Name 128 characters Site URL 255 characters Display name 128 characters Connection string 384 characters Email address 128 characters Version numbers 064 characters Virtual Server Friendly Name 064 characters SQL Database Name 123 characters SQL Database Column 128 characters SQL Database Table Name 128 characters SQL Role Name 128 characters Server Name 128 characters Windows User Name 300 characters Windows Password 300 characters Dependencies per object 032 objects Zone enumeration value 004 zones Default SQL command timeout 300 ...

Portal vs Site

The Portal and website can be differentiated as : Authentication: Portal: It provides facility of Logging-In. Provides you with information based on who you are. e.g. mail.yahoo.com,gmail.com,rediffmail.com Website: No log-in. e.g. www.yahoo.com Personalization : Portal : Limited, focused content. Eliminates the need to visit many different sites . e.g.You type in your user name and password and see your yahoo mail only. Website: Extensive, unfocused content written to accommodate anonymous users needs. Customization : Portal : You will select and organize the materials you want to access. Organized with the materials you want to access. Website : Searchable, but not customizable. All content is there for every visitor. e.g. you can navigate to yahoo mail, yahoo shopping, geo cities, yahoo group. If you wish to use any of these services you will either have to authenticate yourself and see things personalized to you or you can simply visit sections that are for everyone like yahoo ...

SharePoint farms

What is a Farm? A collection of one or more servers, each performing one or more functions: Web Front End (WFE) The old ‘web’ role No service or data, just serves out HTML Network Load Balanced Application Server Hosts ‘services’ Scale out depends on services SQL Server Databases A place where lots of animals are kept and things are grown! J In the context of SharePoint, the term 'farm' is used to describe a collection of one or more SharePoint servers and one or more SQL servers that come together to provide a set of basic SharePoint services bound together by a single Configuration Database in SQL. Farms can range in size from having everything (all SharePoint roles and SQL server) on one machine to scaling out every individual SharePoint serve role onto dedicated sets of servers. A farm the highest administrative boundary for SharePoint and everything that happens inside SharePoint happens in a farm. Server Services and Fault Tolerance Within a farm, there are several servic...

SharePoint Objects hierarchy

The objects in SharePoint relate to each. For example, people do not always understanding the differnence between a site collection and a site or how a web application and content database relate to each other.

Opening an InfoPath form causes error, stating that InfoPath cannot create a new, blank form due to Policy settings prevent opening Internet forms wit

I'm not sure if this error occurs only if you've specified to open the form using InfoPath, or via the web browser. In our scenario, this error occurred only when attempting to open within InfoPath itself. This is really an easy fix however. You merely need to add the URL of the site hosting your form to your IE browser's Trusted Sites.

Unable to cast object of type 'System.Web.Configuration.ScriptingScriptResourceHandlerSection' to type 'System.Web.Configuration.ScriptingScriptResour

After upgrading the application to 3.5, everything was as it should be except for smart part with Ajax with error "Unable to cast object of type 'System.Web.Configuration.ScriptingScriptResourceHandlerSection' to type 'System.Web.Configuration.ScriptingScriptResourceHandlerSection'. "The solution was round the corner : simply add to web.config <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/> <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35"/> <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/> </dependentAssembly> </assemblyBinding>

What are the different life cycle events that WebPart goes through?

A ‘WebPart’ control goes through various events and has a typical life cycle. OnInit: - This is the initialization event and is the first event to occur. OnLoad: - The load event. CreateChildControls: - When any child controls are added to a composite control this event fires. EnsureChildControls: - This event makes sure that ‘CreateChildControls’ fires. OnPreRender: - This fires just before the render event. Page.PreRenderComplete :- When all controls have executed the ‘OnPreRender’ event this event fires. Render: - Render the full control. RenderContents: - Renders the contents of the control only.

How BIG is your SharePoint

Size of Site collection: string siteCollectionURL = “ http://test.moss.com/dc ”; SPSiteAdministration oSPSiteAdministration = new SPSiteAdministration (siteCollectionURL); float scDiskUsage = oSPSiteAdministration.DiskUsed; float sizeOfSiteCollection = (scDiskUsage / (1024 * 1024)); // In MB Total size of sub-sites in Site collection : string siteCollectionURL = “ http://test.moss.com/dc ”; SPSite oSPSite = new SPSite (siteCollectionURL); SPWeb oSPWeb = oSPSite.RootWeb; float totalSubSitesUsage = GetWebSize(oSPWeb); float GetWebSize( SPWeb web) { float total = 0; foreach ( SPFolder folder in web.Folders) { total += GetFolderSize(folder); } foreach ( SPWeb subweb in web.Webs) { total += GetWebSize(subweb); subweb.Dispose(); } return (total/(1024*1024)) ; } float GetFolderSize( SPFolder folder) { float folderSize = 0; foreach ( SPFile file in folder.Files) { folderSize += file.Length; } foreach ( SPFolder subfolder in folder.SubFolders) { folderSize += GetFolde...

Getting a copy of a DLL in the GAC

How you would get a copy of a DLL when it's in the GAC This application takes at least two arguments. The first argument is the physical path to the GAC on the system. The second is the path where the DLL needs to be copied. The following example copies all Crystal components in the GAC to a backup folder: GetGACAssemblies C:\Windows\Assembly C:\Projects\GACBackup Crystal*.dll If you just need a backup of all GAC assemblies, simply do something like this: GetGACAssemblies C:\Windows\Assembly C:\Projects\GACBackup

How do I – Fix the problem where IE crashes when opening Office documents on SharePoint?

OK, this one has several pieces out there in the blogosphere and some more on the newsgroups, but I've not seen a comprehensive post that clearly stipulates why the problem occurs and how to fix it. Why? OK, so first the why. Why does IE (both 6 and 7) crash when I try to open an Office document (Word, Excel, PowerPoint etc.) on SharePoint (WSS or MOSS)? When you try to use the "Edit in Microsoft…" option for a document it always blows up. Sometimes this is also seen when you just simply click on the document which would then open in browse mode. Either way, instead of seeing this: Friendly little warning, you see this: Ugly "The exception unknown software exception (0xc06d007f) occurred in the application at location 0x7c812a5b." error message. When you click the "OK" button, you get another error message, the "The instruction at "0x30cb05e4" referenced memory at "0x00000000". The memory could not be "written." error...

Page Hit Counter in SharePoint

You would have seen many sites displaying page hit counters. To display this in SharePoint page, insert the “Hit Counter” web component from SharePoint Designer.Open your site or your sites Master page to insert this component. For the demonstration purpose, I’ve use my default.aspx to insert the “Hit Counter” component. Once the page is opened in SharePoint Designer, place the cursor where you want to insert the hit counter. Go to Insert --> Web Component. Click on the Web Component, this will display the available web components. You can find different types of other components readily available. Click on the Hit Counter component, this will display different counter styles. Select any one style from the list. I have selected the below marked style. Click on “Finish”, this will open the below Hit Counter Properties window. You can even create your own Hit Counter. Use “Reset counter to” to reset the counter from a given number. To display fixed number of digits use “Fixed number o...