Friday, February 27, 2009

Linq to XML

http://www.hookedonlinq.com/LINQtoXML5MinuteOverview.ashx

Friday, August 22, 2008

How to create WSP solution package

Follow this link
http://www.andrewconnell.com/blog/articles/UsingVisualStudioAndMsBuildToCreateWssSolutions.aspx

Manually run expiration policy jobs

using System;
using System.Collections.Generic;
using System.Text;using System.Diagnostics;
using Microsoft.SharePoint.Administration;
namespace RunExpirationPolicy
{
class Program
{
static void Main(string[] args)
{
foreach (SPService srv in SPFarm.Local.Services)
{
foreach (SPJobDefinition job in srv.JobDefinitions)
{
string jobTitle = job.Title;
if (jobTitle == "Expiration policy")
{
Trace.WriteLine("***************** Start of execution for expiration policy job"); job.Execute(Guid.Empty);
Trace.WriteLine("***************** End of execution for expiration policy job");
}
}
}
}
}}

For more info http://blogs.msdn.com/mattlind/archive/2007/06/05/force-execution-of-expiration-policies-in-moss.aspx

Monday, August 18, 2008

Feature Scope

Web (Web site)
Control
Custom Action
Custom Action Group
Hide Custom Action
List Instance
List Template
Module (File Set)
Receiver

Site (site collection)
Content Type
Content Type Binding
Control
Custom Action
Custom Action Group
Feature/Site Template Association
Field
Hide Custom Action
List Template
Module (File Set)
Workflow

WebApplication (Web application)
Control
Custom Action
Custom Action Group
Document Converter
Feature/Site Template Association
Hide Custom Action

Farm (farm)
Control
Custom Action
Custom Action Group
Feature/Site Template Association
Hide Custom Action

For more information http://msdn.microsoft.com/en-us/library/ms474383.aspx

SPSite.RootWeb.AllUsers | SiteUsers | Users - Difference

We can get list of users (SPUserCollection) based on the following objects.

SPSite.RootWeb.AllUsers
SPSite.RootWeb.SiteUsers
SPSite.RootWeb.Users

"AllUsers" - Gets the collection of users from either member of the site or or who have browsed to the site as authenticated members of a domain group in the site.

"SiteUsers - Gets the collection of all users that belong to the site collection.

"Users" - Gets the collection of user objects that are explicitly assigned permissions on the Web site.

SPPrincipal - SPUser - SPWeb.EnsureUser() - SPUtility.ResolvePrincipal()

SPUtility.ResolvePrincipal() method to fetch details about the user by passing "first, last name" or "user email id" or "user login id".

SPPrincipalInfo object is used to hold user details like, first name, last name, email id, login id with domain name.

SPPrincipalInfo userInfo = SPUtility.ResolvePrincipal(objWeb, "loginID", SPPrincipalType.All, SPPrincipalSource.All, null, false);

------------------------------------------------------------------------------------------------

SPWeb.EnsuerUser() will add ther user to site, if the user does not exist and return SPUser object. We can use SPUser object to update "SPUser" field type
Example:
SPUser objUser = objWeb.EnsureUser("domain\\loginname");
item["user"] = objUser;

-----------------------------------------------------------------------------------------------