Posts

Showing posts from 2009

SharePoint 2007 Maximum Limitations

Intresting facts on sharepoint limitation. 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 More  here

Create and Modify User Profiles in the User Profile Store of SharePoint

This example creates a user profile from the master connection configured on the server. It displays the message 'User profile created' after a successful execution. //Creates a user profile. Obtains the property values from the default //domain controller or the master connection that is configured on the //server using System; using System.Collections.Generic; using System.Text; using Microsoft.SharePoint.Administration; using Microsoft.Office.Server.UserProfiles; using Microsoft.SharePoint; using Microsoft.Office.Server; using System.Web; namespace UserProfilesConsoleApp { class Program { static void Main(string[] args) { try { using (SPSite site = new SPSite("http://servername")) { ServerContext context = ServerContext.GetContext(site); UserProfileManager profileManager = new UserProfileManager(context); string sAccount = "domainname\\username"; if (!profileManager.UserExists(sAccount)) { UserProfile profile = profileMana...

Programmatically creating views for a SharePoint discussion forum

Image
As you can see I'm still working on sites, lists and views and I ran into another challenge. It started out very basic. I wanted to create a discussion forum list on a site. // Create new list listGuid = newWeb.Lists.Add("Forum", "ForumDescription", "Forum", "00BFEA71-6A49-43FA-B535-D15C05500108", 108, "", SPListTemplate.QuickLaunchOptions.Off); SPList forumList = newWeb.Lists[listGuid]; After succesfully creating the forum list I wanted to add a custom view to the list. That seemed to be easy enough as well. // Add an extra view to the list viewFields = new StringCollection(); viewFields.Add("LinkDiscussionTitle"); viewFields.Add("Author"); viewFields.Add("DiscussionLastUpdated"); newView = forumList.Views.Add("Portal View", viewFields, "", 100, true, false); newView.Update(); Unfortunately creating a view using the code above causes the link on the title takes yo...

Add hidden metadata field to SPListItem

Image
You need to add a new field to the list that is marked Hidden="TRUE". You can do this via the object model: using (SPSite sps = new SPSite("http://someServer/")) { using (SPWeb spw = sps.OpenWeb()) { SPList spl = spw.Lists["Shared Documents"]; String strNewField = " "; try { spl.Fields.AddFieldAsXml(strNewField); } catch (SPException spe) { // Notify error that a duplicate name was detected } spl.Update(); } } Note : These hidden field will not appear when we try to create custom view using site action.

Setting Permissions Through Code

When working with permissions through the SharePoint API, there are some key objects to take note of. SPUser – A actual security object in SharePoint (AD User, AD Group or Forms Based User or Group). SPGroup – A SharePoint group defined through SharePoint. SPRoleDefinition – A actual role (permission level) defined in SharePoint (Read, Full Control etc…) SPRoleAssignment – The actual assignment between a SPUser/SPGroup and a SPRoleDefinition // ******************** Adding a SPUser to a SharePoint Group ******************** // Create the site that contains our list SPSite oSite = new SPSite("< >"); // Open the web object SPWeb oWeb = spSite.OpenWeb(); // Get the group that we want to add the user to SPGroup oGroup = oWeb.Groups["< >"]; // Get the user that we want to add to the group SPUser oUser = oWeb.AllUsers["domainlogin"]; // Now we add the user to the groups user collection oGroup.AddUser(oUser); // Update the group...

Programmatically create a view (custom view) of a list

code snippet for creating a custom view ===================================== SPSite oSite = new SPSite([Site URL]);// [Site URL] change it to your sharepoint site URL SPWeb oWeb = oSite.OpenWeb(); SPList oList = oWeb.Lists["shared documents"]; SPViewCollection oViewCollection = oList.Views; string strViewName = "MyCustomView"; System.Collections.Specialized.StringCollection viewFields = new System.Collections.Specialized.StringCollection(); viewFields.Add("Name"); viewFields.Add("Type"); string query = " " + " mysample ";// here you can filter your items using the selected item in the dropdownlist oViewCollection.Add(strViewName, viewFields, query, 100, true, false); oWeb.Update(); Now refresh the list in UI and then you can see the “MyCustomView” in the selection list of views.

Using the SharePoint ‘Person or Group’ field in code

The following code is a simple example of a Console Application which accepts a semi-colon delimited list of aliases (i.e. domain\user;domain\user;domain\user) and then adds them to a ‘Person or Group’ field called ‘MyPersonField’ in a list. Console.WriteLine("Enter a ; delimited list of domain\alias that need to be added:"); string sAliases = Console.ReadLine(); //captures whatever the user entered string sValueToAddToFieldInSP = ""; //used to build the full string needed for the person field string sAllContacts = ""; using (SPSite site = new SPSite(“http://sites/site/yoursite”)) { site.AllowUnsafeUpdates = true; using (SPWeb web = site.RootWeb) { web.AllowUnsafeUpdates = true; string[] aAliases = sAliases.Split(';'); foreach (string sAlias in aAliases) { SPUser user = web.EnsureUser(sAlias); sAllContacts += user.ID.ToString() + ";#" + user.LoginName.ToString() + ";#"; } web.Update(); } ...

MOSS Architecture Diagram

http://www.microsoft.com/downloads/details.aspx?FamilyID=14c6b1c1-ad26-4ed0-87b8-b691ebdd9662&displaylang=en#filelist

How to shrink SQL database to increase disk space

 USE DatabaseName GO DBCC SHRINKFILE( , 1) BACKUP LOG WITH TRUNCATE_ONLY DBCC SHRINKFILE( , 1) GO In Case of SharePoint server .this problem often observed .to resolve the same ..following query works well for me USE SharePoint_Config GO DBCC SHRINKFILE(SharePoint_Config_log, 1) BACKUP LOG SharePoint_Config WITH TRUNCATE_ONLY DBCC SHRINKFILE(SharePoint_Config_log, 1) GO

SharePoint Price Calculator

We often hear questions from clients about how licensing works for Microsoft Office SharePoint Server.  To which one need to really have talk with a Microsoft Licensing Specialist in order to get pricing as there are different pricing models for different types of organizations. But, I found this great Web site called the SharePoint Price Calculator  that will give you cost estimates based on the number of employees, number of Web Front Ends, number of servers, and number of SQL Servers. Enjoy!

Guidelines for acceptable performance in MOSS

Capacity is directly affected by scalability. This section lists the objects that can compose a solution and provides guidelines for acceptable performance for each type of object. Limits data is provided, along with notes that describe the conditions under which the limit obtain as well as links to additional information where available. Use the guidelines in this article to review your overall solution plans. If your solution plans exceed the recommended guidelines for one or more objects, take one or more of the following actions: Evaluate the solution to ensure that compensations are made in other areas. Flag these areas for testing and monitoring as you build and deploy your solution. Re-design the solution to ensure that you do not exceed capacity guidelines. The following tables list the objects by category and include recommended guidelines for  acceptable performance . Acceptable performance means that the system as tested can support that number of objects,...

Run stsadm.exe command from any command prompt

In share Point,One can perform the various configuration and customisation operations using command prompt as like as central administration GUI using stsadm Command •  Open command prompt •  Type in the following command:   @set PATH=C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN;%PATH%   •  You can now run the stsadm.exe commands from anywhere in the command prompt

How to create custom page layout for publishing site

Hi    For publishing sites template in sharepoint .we have common requirement to customise the page layout.To understand how to- Create and modify layout pages Office SharePoint Designer 2007 has all the tools to help designers create ASP.NET master page layouts. Using master pages, you can create a single page template and then use that template as the basis for multiple pages in an application, instead of having to build each new page from scratch. With page layouts in Office SharePoint Server 2007, designers create the look and feel for a type of page, without worry about non-designers will break the brand or flow of the site. Get started building master pages right away with this demonstration. Click here to view the demonstration.

WSS 3.0 vs MOSS 2007- Short Features List

When choosing a SharePoint technology, it is best to determine what features you require. Below is a short features list; however if you require more details, the complete features are listed further below: WSS 3.0 Features MOSS 2007 Features WSS 3.0 can be hosted in either shared or dedicated environments for additional security and performance. Blogs Wikis Surveys Project Tracking Issue Tracking Delegation Collaboration The highly secure environment of MOSS 2007 makes it a great investment for business communications. Social Networking Document Workflow Content Syndication Site Directory Form Management Dashboards Authentication

Windows SharePoint Services v3.0 vs Microsoft Office SharePoint Server 2007

Features included in MOSS that are not included in WSS : Social Networking MOSS provides social networking features, including social networking Web Parts and profile linking. MOSS allows you to establish peer links between colleagues and identify hierarchical relationships. These relationships can be published on My Site pages and traversed wherever your personal profile appears on a site/web part. My Site MOSS provides the ability for individual users of a portal to create their own "My Site". My Site is essentially a home page / landing page designed to provide you with a starting point through which to access content that you own and content that might be relevant to you. This is also the place where your personal profile is published. You can also create shared and private image and document libraries, as well as your own pages and publication areas. You can also create your own personal blog on your My Site. Some people think of a My Site as a "professional...

How can I track the number of hits on my blog? // Blogspot

Best one    www.statcounter.com others http://freelogs.com/ www.pliner.net

Design Patterns...useful

Long Absence - Design Patterns Design Patterns - Strategy Pattern Design Patterns - Observer Pattern Design Patterns - Observer/Event Pattern Design Patterns - Decorator Pattern Design Patterns - Factory Method Pattern Design Patterns - Abstract Factory Pattern Design Patterns - Singleton Pattern Design Patterns - Generic Singleton Pattern Design Patterns - Command Pattern Design Patterns - Adapter Pattern Design Patterns - Facade Pattern Design Patterns - Template Method Pattern Design Patterns - Iterator Pattern Design Patterns - Composite Pattern Design Patterns - State Pattern Design Patterns - Proxy Pattern To learn more click here.  :    http://blog.cumps.be/design-patterns-proxy-pattern/