Wednesday, 23 May 2012

Types of Deployment in SharePoint 2007

Who Needs Deployment?

Regarding the development environment, there are two types of SharePoint projects:
  • Single environment projects, where everything is configured and developed directly in the production environment;
  • Multiple environment projects, where all the development and configuration is done in a development environment, then possibly deployed to a testing environment, and finally deployed to the production environment.
Additionally, you can have two types of farms, in a SharePoint installment:
  • Single server farm, when there is only one SharePoint Server in the farm (although there can be additional SQL Servers);
  • Multiple server farm, when there are several SharePoint Servers, possibly with different server roles, in the farm.
For Single Server – Single Environment projects, which are the least common type, the developers don't really need to be concerned about deployment since everything is done on the same server. But for the other types of projects (Single Server – Multiple Environment, Multiple ServerSingle Environment and Multiple Server Multiple Environment) developers will need to deploy their work to the servers.

What Does Deployment Mean, in a SharePoint Sense?

In SharePoint, deployment means the necessary actions to install your software solution in a SharePoint environment, whether that solution consists of web parts, custom web controls, event handlers, custom web pages, or just master pages.
So, imagine you have created site columns and content types directly on the SharePoint UI, customized some master pages using SharePoint Designer and installed a few custom web parts on your Development Environment, and now you need to deploy this to the Testing Environment (and later on, to the Production Environment). You can choose from a few different deployment methods:
  • Stone Age Deployment. You do it all over again in the Testing Environment, and later you will repeat the procedure in the Production Environment. It's not hard to figure out this is a bad practice: probably you won't be able to repeat the tasks in the exact same order as you did before, and that might result in errors or in a Testing Environment that is not a replica of the Development Environment. Also, that means the developers must have administration access in all the environments, which is not always the case.
  • Backup/Restore Deployment. You perform a farm backup on the Development Environment and restore it in the Testing Environment. Although commonly used, it's not the best practice either: you must make sure all the assemblies, web.config modifications, and file system changes are present in the destination environment before you restore the backup. Also, you might have some problems if the environments are not in the same windows domain.
  • Content Deployment. You use SharePoint's content deployment paths and jobs. That can be a good solution, but it has some limitations: unless you are deploying a whole site collection, you'll need to make sure all the assemblies, web.config modifications, and file system changes are present in the destination environment before you restore the backup. Content deployment is targeted at "contents" and not at "structure", although some of the SharePoint structures are migrated with the contents. Also, both environments must be connected for automatic content deployment to work. You have the option to export a site collection to a .CAB file and import it in the destination environment using STSADM commands, but the same limitations apply.
  • Solution Deployment. You build SharePoint Features for all the objects you developed and pack them in one or more SharePoint Solutions. This is the recommended approach for structure deployment, since it allows for multiple server farm deployment, allows the deployment of assemblies, web.config modifications, files in file system folders as well as all SharePoint objects.

Tuesday, 22 May 2012

How to view all user of a active directory group


public static DataSet GetUsersForGroup(string GroupName)
{
DataSet dsUser = new DataSet();
DirectoryEntry de = GetDirectoryObject();

//create instance fo the direcory searcher
DirectorySearcher deSearch = new DirectorySearcher();

//set the search filter
deSearch.SearchRoot =de;
//deSearch.PropertiesToLoad.Add("cn");
deSearch.Filter = "(&(objectClass=group)(cn=" + GroupName +"))";

//get the group result
SearchResult results= deSearch.FindOne();

//Create a new table object within the dataset
DataTable tbUser = dsUser.Tables.Add("Users");
tbUser.Columns.Add("UserName");
tbUser.Columns.Add("DisplayName");
tbUser.Columns.Add("EMailAddress");

//Create default row
DataRow rwDefaultUser = tbUser.NewRow();
rwDefaultUser ["UserName"]= "0";
rwDefaultUser ["DisplayName"]="(Not Specified)";
rwDefaultUser ["EMailAddress"]="(Not Specified)";
tbUser.Rows.Add(rwDefaultUser);

//if the group is valid, then continue, otherwise return a blank dataset
if(results !=null)
{
//create a link to the group object, so we can get the list of members
//within the group
DirectoryEntry deGroup= new DirectoryEntry(results.Path,ADAdminUser,ADAdminPassword,AuthenticationTypes.Secure);
//assign a property collection
System.DirectoryServices.PropertyCollection pcoll = deGroup.Properties;
int n = pcoll["member"].Count;

//if there are members fo the group, then get the details and assign to the table
for (int l = 0; l < n ; l++)
{
//create a link to the user object sot hat the FirstName, LastName and SUername can be gotten
DirectoryEntry deUser= new DirectoryEntry(ADFullPath + "/" +pcoll["member"][l].ToString(),ADAdminUser,ADAdminPassword,AuthenticationTypes.Secure);

//set a new empty row
DataRow rwUser = tbUser.NewRow();

//populate the column
rwUser["UserName"]= GetProperty(deUser,"cn");
rwUser["DisplayName"]= GetProperty(deUser,"givenName") + " " + GetProperty(deUser,"sn");
rwUser["EMailAddress"]= GetProperty(deUser,"mail");
//append the row to the table of the dataset
tbUser.Rows.Add(rwUser);

//close the directory entry object
deUser.Close();

}
de.Close();
deGroup.Close();
}

return dsUser;
}

Friday, 18 May 2012

jQuery font issue in SharePoint

I tried to added jquery datepicker in the custom webpart finally added the datepicker.  After that I noticed in my SharePoint 2007 site menu style totally changed the font size of the menu became tiny.

The way to fix the problem is

1. Open the jquery style sheet demos.css
2. Remove the style
 table
 {
    font-size: 1em;
  }

now it is working fine.

Happy Coding :)

Wednesday, 9 May 2012

How to Change the size of Default settings page and list page in SharePoint 2010 and change the body background color completely

Hi I was designed a master page and page layout for a branding site.  The master page having 950px width and aligned in the center.

But the problem is when I visit the default page of SharePoint like site setting, view all site content they all are remains in the same width. 

I wondered because I covered the content place holder by a div with 950px width.  But it is not applied so I decided to do a smart work.  Open the firefox and check the style with the help of firebug I found that a content table completely keep the default page there a style that take about the width and the color. 

.s4-ca {
    background: none repeat scroll 0 0 #fffff;
    margin-left: 155px;
    margin-right: 0;
    min-height: 324px;
}

I change the style as per my wish....

then paste it to my master page to override.

Now it is working....  

If you remove background color property at the time you can able to get the background color defined in the body style class..   But it is not looking fair......

Happy Coding:)

Hide the master page menu in the pop ups like 'check in' in SharePoint 2010

         Now am busy with the branding task.  We are working to develop a custom master page using v4.master in SharePoint 2010.   We almost finish the development but we face a problem that is when the user going to check in the page at the time a pop up comes with lightbox effect the our master page menu is displayed.

         That is not we expected.  So I am tried to resolve the problem in a smart way.  By using the developer tool in Mozilla Firefox I found the master page header and remaining items are hide out by dynamic div section that is asp panels. 

         Our menu is inside the default asp panel called pnlMenu  so I commented the panel but still it displayed then I check the header content's asp panel that is hide out while displaying the pop up.  

         Simply cut and paste my menu to there....

         Now it is working fine..... 

         Happy Coding :)

Tuesday, 8 May 2012

How to deploy the SharePoint 2010 custom solution

  1. Build your project
  2. Right click your project and select package
  3. You can see the .dll file, .wsp file and .pdb file under the bin/debug folder copy those thing and paste the folder which you are going to provide the solution to the client.
  4. create batch file named 'setup2010.bat' or your wish
  5. Write the following code
  6. SET STSADM="c:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\bin\STSADM.EXE"
    %STSADM% -o retractsolution -name "solutionname.wsp" -immediate
    %STSADM% -o execadmsvcjobs
    %STSADM% -o deletesolution -name "solutionname.wsp"
    %STSADM% -o execadmsvcjobs
    %STSADM% -o addsolution -filename "solutionname.wsp"
    %STSADM% -o execadmsvcjobs
    %STSADM% -o deploysolution -name "solutionname.wsp" -immediate -allowGacDeployment -allowCasPolicies -force
    %STSADM% -o execadmsvcjobs
  7. Here I use the site scope so am not going to all content urls if you use webscope at the time you must be add like following
     SET STSADM="c:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\bin\STSADM.EXE"
    %STSADM% -o retractsolution -name "solutionname.wsp" -immediate -allcontenturls
    %STSADM% -o execadmsvcjobs
    %STSADM% -o deletesolution -name "solutionname.wsp"
    %STSADM% -o execadmsvcjobs
    %STSADM% -o addsolution -filename "solutionname.wsp"
    %STSADM% -o execadmsvcjobs
    %STSADM% -o deploysolution -name "solutionname.wsp" -immediate -allcontenturls  -allowGacDeployment -allowCasPolicies -force
    %STSADM% -o execadmsvcjobs
Execute it in the client side
 Happy Coding:)