Wednesday, May 5, 2010

Creating a Solution Package(.wsp) in 5 Steps

For those who are new to the SharePoint solutions and features I would recommend to try the SharePoint Solutions Generator, which is a part of the Windows SharePoint Services 3.0 Tools: Visual Studio 2005 Extensions. It is a windows stand-alone application that converts your existing SharePoint web site into the solution package and creates a Visual Studio project for you to use.


What I personally don’t like in the automatic tools is that they always hide some part of the job they are doing behind the scenes. In this scenario you can’t really control and sometimes understand of that is going on. So, today I would like to blog about of how to manually create the SharePoint feature containing the list, how pack it into the solution package and finally deploy it to the production server. Everything will be done without any use of Visual Studio or other tools (only Notepad++).

So, let’s start!

Step 1. Folders

First, create the folder structure for the solution. I used MySolution but you can give a name whatever you want. Two folders were created beneath MySolution - source and bin. First is for the compiled package, second – to keep the feature and the customized list. I use the same file structure for the feature as in SharePoint - one folder per feature. Check out your SharePoint features hive at C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\DiscussionsList and see how it’s organized.

In the source folder I made the feature folder called MyList and 2 subfolders inside - List Templates and Messages. In the end you will have something like this:



Step 2. Building a Feature.



Here we create our feature based on the SharePoint discussions list. Go to MyList folder and create a file feature.xml, where we reference 2 files, first – list manifest MyListManifest.xml and the second – schema.xml which is describing the list metadata. And don’t forget to change the GUID of feature Id with your own!

feature.xml






Title="My Feature"

Description="This is my feature containing a list"

Version="1.0.0.0"

Hidden="FALSE"

Scope="Web"

DefaultResourceFile="core"

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













Copy the original schema.xml file from the C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\DiscussionsList\Discuss folder to the Messages folder, and you have a list schema to start from, MyListManifest.xml we’ll create manually in the ListTemplates folder –



MyListManifest.xml







Name="Messages"

Type="108"

BaseType="0"

OnQuickLaunch="FALSE"

FolderCreation="FALSE"

SecurityBits="12"

Sequence="999"

DisplayName="My List"

Description="This is my custom list based on the discussions list"

Image="/_layouts/images/itdisc.gif"/>



What is important here is that the Name attribute must have the same name as the folder where schema.xml is placed, Messages, as SharePoint will look for the schema.xml file at that location!

After the end of this step you have 3 new files as seen on the picture









Step 3. Building a Solution Package (.wsp)

SharePoint Solution Packages (wsp ) provide a great way to distribute all your customization in just one flask and the creation of the .wsp ain’t so painful operation as you may think, I would say it is easy as hell! Everything starts from the traditional solution manifest .xml file in the Source folder:

manifest .xml





SolutionId="EC2EFD73-DBA2-4c0e-9C18-C8FC43F72E6C" >









Here, we reference our Feature.xml file that we had created before at the Step 2, and as you may guess it’s a good way to replace the the SolutionId GUID with something brand new J. The next that should be created is the data definition file (.ddf). It’s a simple text file with the building instructions for the makecab utility because the .wsp package is nothing more than a cabinet file with the .wsp extension. (If you rename .wsp or .stp file to .cab you’ll be able to see its contents). Let’s create a wsp.ddf in the Source folder:



wsp.ddf

.OPTION Explicit

.Set DiskDirectory1="..\bin"

.Set CabinetNameTemplate="MyListSolution.wsp"

manifest.xml

; These directory names (DestinationDir) are used for the folders creation under 12\TEMPLATE\Features

.Set DestinationDir="MyList\ListTemplates"

MyList\ListTemplates\MyListManifest.xml

.Set DestinationDir="MyList\Messages"

MyList\Messages\schema.xml

.Set DestinationDir="MyList"

MyList\Feature.xml

In this file we set an output folder for the compiled package..\bin, its name MyListSolution.wsp and we tell makecab to include 4 files (marked in red) and create 3 folders at the deployment phase (in blue). Now it’s time to build everything into a single file, but before we do that I create a build.cmd file in the Source folder with some lines to facilitate the building process



build.cmd

@setlocal

@pushd.

@cd %~dp0

makecab /f wsp.ddf

@popd

@endlocal

Here I reference the wsp.ddf file with processing instructions which I created before. After you run it your solution package will appear in the bin folder:

Step 4. Solution deployment.

So, the solution package has just been created and the last thing that is left to do is to deploy it to our production server. I always like then the script is doing my job, so I put 2 .cmd files into the bin folder to deploy and retract my.wsp package so I don’t have to deal with stsadm utility from command line.


DeployMyListSolution.cmd

@setlocal

@pushd.

@set PATH=C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN;%PATH% @cd %~dp0

stsadm.exe -o addsolution -filename MyListSolution.wsp

stsadm.exe -o deploysolution -name MyListSolution.wsp -local

@pause

@popd

@endlocal

RetractMyListSolution.cmd

@setlocal

@pushd.

@set PATH=C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN;%PATH% @cd %~dp0

stsadm.exe -o retractsolution -name MyListSolution.wsp –local

stsadm.exe -o deletesolution -name MyListSolution.wsp

@pause

@popd

@endlocal

















After the solution is deployed you can activate the feature in the Site features menu of you site and start using the new list!





Step 5. Using the feature.

Before our custom list can be used the feature containing it must be activated within the SPWeb scope.















After activation is done your custom list will appear on the site’s create

Friday, April 30, 2010

Creating a MOSS 2007 State Machine Workflow

 Hello Friends,
                      Below is creation of state machine workflow

 This will actually be a short series of posts covering the following topics:

1. Concepts and planning
2. Creating InfoPath forms
3. Developing the workflow
4. Deploying the workflow

Before you get started, you’ll need to make sure you’ve downloaded and installed the latest Office Server SDK (which comes with the Visual Studio workflow templates for SharePoint).

Business Case:
                 State machine workflows are good at automating processes that change between different states (or statuses) throughout the lifetime of the workflow. They have a defined beginning and end state, but the behavior in between those two points can vary based on inputs.

In this example, I’ll show a quick state machine representing a proposal creation process.

Let’s say Acme Widgets uses a proposal process to quote prices and sell its goods.

1. Roger, the salesperson, prepares a proposal, which must then be reviewed by the sales manager, Sheila.
2. Sheila may either approve the proposal to submit to the customer, or she can kick it back to Roger for modifications.
3. If Roger has to modify it, he does so, and then sends it back to Sheila for approval.
4. Once approved, Roger submits the proposal to the customer and awaits the outcome.

The customer can do one of three things:

Accept the proposal

Reject the proposal

Request modifications to the proposal

A graphical representation of the process looks something like this


The colored bands in the diagram represent the “state” of the workflow at a given point in time. This concept will be important when we actually design the workflow.

Side note: If you don’t do it already, I’d highly recommend doing a conceptual flow chart (similar to the one above) for your workflows. It doesn’t take long and offers clarity for you throughout the development process.

Note that the ability to go “backward” in the workflow is one of the factors that will determine whether you choose to implement a state machine workflow instead of a sequential one.

Planning

Based on the flow chart that I created, I can easily see what InfoPath forms I’m going to need to create for the various steps in the process.
Association Form. Ok, this isn’t represented in the flow chart, but I know I’ll need to create one to set any association-specific information for my workflow.
Initiation Form. This will be the one that is filled out when the workflow is first initialized.
Review Form. This will be the form used by the proposal reviewer. It needs to have the option to approve the proposal or to send it back to the creator for modifications. In either case, the reviewer should have the option to add comments that will be written to the workflow history list.
Modification Form. This form will be used by the salesperson to comment about any changes made to the proposal when re-submitting it for review. I can probably use the same InfoPath form as the initiation form here.
Pending Customer Form. This form will be used to specify the outcome of the submission of the proposal to the customer. The possible options here are to send the proposal back for modifications, mark that the customer rejected the proposal, or mark that the customer accepted the proposal.

Thursday, March 4, 2010

Benefits of Microsoft Office SharePoint Server 2007

Hello Guys,


      Below are the benefits of MOSS 2007
  •  Provide a simple, familiar, and consistent user experience.
  •  Boost employee productivity by simplifying everyday business activities.
  •  Help meet regulatory requirements through comprehensive control over content.
  •  Effectively manage and repurpose content to gain increased business value.
  •  Simplify organization-wide access to both structured and unstructured information across disparate systems.
  •  Connect people with information and expertise.
  •  Accelerate shared business processes across organizational boundaries.
  •  Share business data without divulging sensitive information.
  •  Enable people to make better-informed decisions by presenting business-critical information in one central location.
  •  Provide a single, integrated platform to manage intranet, extranet, and Internet applications across the enterprise. 

About Content Query

Hi Everyone,


             Content Query:
                                        We can use a Content Query control to link to pages or other items that are displayed based on a query that you design. For example, if you are presenting articles in an online news site, you could add a Content Query control to your site's Welcome Page layout so that new articles are highlighted on that page. You can build complex queries by using the Content Query field control. For example, you can specify which sites in your site collection to query, which lists to use, and what audience to target. You can also filter queries based on lists or libraries metadata.

We can add a Content Query control to a layout page in two ways:
·      We can add it directly to the layout page and configure it. When you do this, any page that uses the layout page will display the results of the query.
·       We can add it as a Web Part to a Web Part zone. When you do this, authors can modify the query or delete the Content Query control.

Wednesday, March 3, 2010

Convert MS Excel to SQL Server



Converting Excel database spreadsheets to a MS SQL Server database provides a far more structured, more repeatable approach for business critical processes. Excel spreadsheets provide infinite flexibility, but at the cost of bad data, and the cost of managing a distributed application that is intended for just one or a few users.  SQL Server database supports well-structured data, and repeatable, high quality data and workflow processes, with unlimited number of concurrent End Users. The good news is that PCA can migrate your Excel spreadsheets to MS SQL Server, and make your Excel Application more structured, while preserving the original functional integrity of the original MS Excel spreadsheet.




       Comparison of MS Excel to SQL Server:

   

MS Excel
SQL Server
Workflow
None (Email)
Process-flow defined
Concurrent Updates
No (Single User)
Yes (Multiple, concurrent Users)
Security
One password fits all
Role-based privileges
Version Issues
High (file data stamp)
None
Audit-ability
Low (date and email comparisons)
High (full audit trail)
Data Integrity
Low (somewhat constrained)
Highly constrained
Data Capacity
Limited
Unlimited
Data Structures
Flat: 2-dimensions
Relational: 3-dimensions

Friday, February 5, 2010

Advantages of Data View Web Part(DVWP)

It has been posting interesting articles about Data View Web Part (DVWP).
I know a great deal about Data View Web Part and there are numerous solutions I posted here which were created with it (Blog archive SharePoint Lists and Libraries, Outlook Style KPIs).


We can use Data View Web Part to pull data from subsites


We can use Data View Web Part to aggregate data from more than one list


For more details check her post, or attend one of the online workshops about DVWP at End User SharePoint.


Advantage: This is very important for Windows SharePoint Services users since you do not have Content Query Web Part in WSS. By using DVWP you might be able to aggregate and present information in very interesting ways.


Problem: Although DVWP can aggregate data from subsites you would have to pre-configure all the sources. In case you add a new site you will need to ad it to your data sources. (I presume it might not perform very well when multiple sources are used).


Conclusion: No matter how hard you learn, when it comes to SharePoint, there is always something new to learn. Keep your eyes open!

Monday, January 25, 2010

Creating a SharePoint Site

    To create a SharePoint site, you must be a member of a site group that has the Create Subsites permission. This permission is included by default in the Full Control permission level. If you don't have the necessary permission, contact your server administrator.
  1. On the File menu, point to New, and then click Web Site.
  2. In the Specify the location of the new Web site box, type the location where you want to create the new site, including a name for the site.
    Web Site tab of New dialog box
    For example, you might type http://My_Server/My_Site as the URL of your new SharePoint site.  By default, Office SharePoint Designer 2007 suggests both a location and a name for the new site that are based on the site most recently opened. You may want to change either the location or the name, or both.

  3. In the leftmost pane, click the category of template that you want to create.
    If you click SharePoint Templates, the list of available templates is retrieved from the server. At this point, you may be prompted to enter your user name and password to log on to the server.
      The list of SharePoint site templates is retrieved from the current server. When you connect to another server, you may see more, fewer, or other templates, depending on which ones the server administrator has made available.
  4. In the center pane, click the template that you want to use to create your site.
  5. If you want to add the new site to the current site — as folders in the current site, and not as a separate site — select the Add to current Web site check box. This check box is available only when you already have a site open.
      Because this option applies the selected template to the current site, you can use the option only if no other template is already applied. For example, you cannot add a new site that you create from the Team Site template to a site that was created from the Blank Site template. In such a case, the only way to apply a new template is to delete the site and then re-create it based on another template.
  6. If you want to use encrypted connections, select the Use Encrypted Connection (SSL) check box.
  7. Click OK.
    If you have chosen Import Web Site Wizard in the General category, the Import Web Site Wizard opens. Remember that the Import Web Site Wizard uses the Publishing feature, which cannot copy or move SharePoint content such as lists or libraries. Therefore, you cannot use the wizard to import a SharePoint site.
  8. The new site is created on the server.