Search This Blog

Friday, October 23, 2009

[Tutorial] Creating a SharePoint 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. Nice isn’t it?

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
<?xml version="1.0" encoding="utf-8"?>
<Feature Id="A8E6B85F-D81A-4cc1-9708-D15FEF359DE2"
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/">
<ElementManifests>
<ElementManifest Location="ListTemplates\MyListManifest.xml" />
<ElementFile Location="Messages\schema.xml"/>
</ElementManifests>
</Feature>

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

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<ListTemplate
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"/>
</Elements>

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

<?xml version="1.0" encoding="utf-8"?>
<Solution xmlns="http://schemas.microsoft.com/sharepoint/"
SolutionId="EC2EFD73-DBA2-4c0e-9C18-C8FC43F72E6C" >
<FeatureManifests>
<FeatureManifest Location="MyList\Feature.xml"/>
</FeatureManifests>
</Solution>

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 page and you can create list instances!

Have fun!
Next time I will talk about site definitions inside the solutions.

Reference from : Evgeny Tugarev

Tuesday, October 20, 2009

[Tutorial] PDF iFilter for MOSS

 

There are a few posts on the net relating to PDF iFilter for MOSS and I haven't had a lot of luck with them including the one that was released by Adobe Labs for x64 bit. A few of our clients have requested capability to search the PDF documents and we didn't have a standard on how we go it done but one way or the other we did. Since people are still looking for ways to make this work I've decided to make a post that show how we got the iFilter to work.

I haven't tested this procedures on a x64 environment but i certainly know they work for a x86 environment.

This process should be installed on your indexing server.

Here is the process.

  1. Download the PDF iFilter 6.0 application from Adobe
  2. Stop the IIS Admin Services -- From Windows Services.
  3. Run your IFilter Install (Remember it needs to be on your indexing server)
  4. After the installation completes perform an IISRESET/noforce -- prevents data loss in case IIS has issues responding within a minute.

Add the PDF Icon to SharePoint -- this is more of a cosmetic thing to allow PDF files to be easily identified by your users

  1. Download a PDF Icon from Adobe based on your specification.
  2. Copy the Icon to SharePoint Images folder "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\Template\Images"
  3. Add the Icon mapping into the DOCICON.XML (Can be found at "C:\Program Files\Common Files\Microsoft Shared\Web server extensions\12\Template\Xml\".
  4. <Mapping Key="pdf" Value="pdficon.gif"/>
  5. Add PDF as a new search file in SharePoint Central Administration -> "Shared Services Provider(SSP)"--> Search Settings -> File Types

Configure SharePoint Index Server Registry to recognize the PDF IFilter as described in this Microsoft HotFix which I have iterated below

  1. Add the following registry entry, and then set the registry entry value to pdf:

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\12.0\Search\Applications\<GUID>\Gather\Search\Extensions\ExtensionList\38

    To do this, follow these steps:

    1. Click Start, click Run, type regedit, and then click OK.
    2. Locate and then click the following registry subkey:

      HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\12.0\Search\Applications\GUID\Gather\Search\Extensions\ExtensionList

    3. On the Edit menu, point to New, and then click String Value.
    4. Type 38, and then press ENTER.
    5. Right-click the registry entry that you created, and then click Modify.
    6. In the Value data box, type pdf, and then click OK.
  2. Verify that the following two registry subkeys are present and that they contain the appropriate values.
    Note These registry subkeys and the values that they contain are created when you installed the Adobe PDF IFilter on the server.
    • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\12.0\Search\Setup\ContentIndexCommon\Filters\Extension\.pdf

      This registry subkey must contain the following registry entry:

      • Name: Default
        Type: REG_MULTI_SZ
        Data: {4C904448-74A9-11D0-AF6E-00C04FD8DC02}
    • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\12.0\Search\Setup\Filters\.pdf

      This registry subkey must contain the following registry entries:

      • Name: Default
        Type: REG_SZ
        Data: (value not set)
      • Name: Extension
        Type: REG_SZ
        Data: pdf
      • Name: FileTypeBucket
        Type: REG_DWORD
        Data: 0x00000001 (1)
      • Name: MimeTypes
        Type: REG_SZ
        Data: application/pdf
  3. Upload the PDF documents to the Windows SharePoint Services 3.0 Web site.
  4. Stop and then start the Windows SharePoint Services Search service. To do this, follow these steps:
    1. Click Start, click Run, type cmd, and then click OK.
    2. Stop the Windows SharePoint Services Search service. To do this, type net stop spsearch at the command prompt, and then press ENTER.
    3. Start the Windows SharePoint Services Search service. To do this, type net start spsearch at the command prompt, and then press ENTER.
    4. Type exit to exit the command prompt.

Hopefully this saves someone the headache of trying to get the iFilter to work

Reference from : lmundia’s Blog

[Tutorial] Steps to Import a Web Part

Step 1 : Click on “Site Action>Edit Page

image

Step 2 : Now you are in “edit mode” and click on “Add a Web Part”.

image

Step 3 : Click“Advanced Web Part gallery and option” in order to import a web part in your page.

image

Step 4 : Click on “Browse” and then “Import”.

image

Step 5 : The panel then changed to Import Interface. Click on “Browse”.

image

Step 6 : Select the .webpart you would like to import and click “Open

image

Step 7 : After that, click “Upload” and the Web Part is added in the “Uploaded Web Part” zone. Select the dropdown from the “Add to” list for the Web Part position and then click “import

image

Step 8 : Now you have success import a Web Part for your local computer.

image

[Tutorial] Customize Content Query Webpart Item Style in XSLT – DateTimeFormat

Here share with you on how to customize the Item Style in itemStyle.xsl...

Step 1 : Open SharePoint Designer and then click on “File” to “Open Site” for the portal.

image 

image

Step 2 : After you have success open the portal content, a tree-view “Folder List” for the portal content will be display on left hand corner.

image

Step 3 : Double Click on “Style Library” > “XSL Style Sheets” > “ItemStyle.xsl”. All Item Style now listed out on your right hand corner.

image

Step 4 : Assume you wan to poll out Site Column “EventDate” and “EndDate” from you content.you can check internal name for the Site Column for example “Start Date” by right click property of the Site Column.

image

P.S. More way get to know Internal Site Column value please visit Customizing the Content Query Web Part and Custom Item Styles.

Step 5 : Sample Code to show “Event Date” and “EndDate”. Before that please ensure on the top you have already include

(xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime") in your “<xsl:stylesheet>”

Item Style

Step 6 : After you have finished included all code and now you can add a “Content Query Web Part” to use this item Style.

Click http://atquestdemo.blogspot.com/2009/10/practice-apply-custom-item-style-for.html to see how to use item style for Content Query Web Part.

Step 7 : Note that you would not get the output correct unless you do something on the Web Part. Therefore, you have to “Export” it and make changes through “Note Pad.exe

image

Step 8 : After you have success open it look for “CommonViewFields” and start addin the “Internal Site Column” value follow by “data type”.

image

Step 9 : Import the edited web part back to the site and you able to view the whole style format.

Click here to see how to import Webpart!

image

Additional Notes

  • Date Time Format Style

image

image

image

image

image

Reference from : Csharp-example : String Format for DateTime [C#]

  • Content Type for Site Columns

image

Reference from : Heathersolomon : Customizing the Content Query Web Part and Custom Item Styles

Step By Step Guide for Windows Server 2008 Domain Controller and DNS Server Setup

Click on Start > Run


Now type dcpromo > Click OK

The system will start checking if Active Directory Domain Services ( AD DS) binaries are installed, then will start installing them. The binaries could be installed if you had run the dcpromo command previously and then canceled the operation after the binaries were installed.

The Active Directory Domain Services Installation Wizard will start, either enable the checkbox beside Use Advanced mode installation and Click Next , or keep it unselected and click on Next

The Operating System Compatibility page will be displayed, take a moment to read it and click Next

Choose Create a new domain in a new forest, Click Next

Enter the Fully Qualified Domain Name of the forest root domain inside the textbox, click Next

If you selected Use advanced mode installation on the Welcome page, the Domain NetBIOS Name page appears. On this page, type the NetBIOS name of the domain if necessary or accept the default name and then click Next.

Select the Forest Functional Level, choose the level you desire and click on Next.

Make sure to read the description of each functional level to understand the difference between each one.

In the previous step, If you have selected any Forest Functional Level other than windows Server 2008 and clicked on Next , you would then get a page to select the domain Functional Level. Select it and then click on Next

In the Additional Domain Controller Options page, you can select to install the domain NameService to your server. Note that the First domain controller in a forest must be a Global Catalog that’s why the checkbox beside Global Catalog is selected and it cannot be cleared. The checkbox is also selected by default when you install an additional domain controller in an existing domain, however you can clear this checkbox if you do not want the additional domain controller to be a global catalog server. The first domain controller in a new forest or in a new domain can not be a Read Only Domain Controller (RODC), you can later add a RODC but you must have at least one Windows Server 2008 Domain Controller.

I want to set my DC as a DNS Server as well, so I will keep the checkbox beside DNS serverselected and click on Next

If you don’t have static ip assigned to your server you will see similar to the following screen now you need to assign static ip and start the above process.

If the wizard cannot create a delegation for the DNS server, it displays a message to indicate that you can create the delegation manually. To continue, click Yes

Now you will have the location where the domain controller database, log files and SYSVOL are stored on the server.

The database stores information about the users, computers and other objects on the network. the log files record activities that are related to AD DS, such information about an object being updated. SYSVOL stores Group Policy objects and scripts. By default, SYSVOL is part of the operating system files in the Windows directory either type or browse to the volume and folder where you want to store each, or accept the defaults and click on Next

In the Directory Services Restore Mode Administrator Password (DSRM) page, write a password and confirm it. This password is used when the domain controller is started in Directory Services Restore Mode, which might be because Active Directory Domain services is not running, or for tasks that must be performed offline.Make sure that you memorize this password when you need it.

Summary page will be displayed showing you all the setting that you have set . It gives you the option to export the setting you have setup into an answer file for use with other unattended operations, if you wish to have such file, click on the Export settings button and save the file.

DNS Installation will start

Followed by installing Group Policy Management Console, the system will check first if it is installed or not.

Configuring the local computer to host active directory Domain Services and other operations will take place setting up this server as a Domain Controller active Directory Domain Services installation will be completed, click Finish.

Click on Restart Now to restart your server for the changes to take effect.

Once the server is booted and you logon to it, click on Start > Administrative Tools
you will notice that following have been installed :
Active Directory Domains and Trusts
Active Directory Sites and Services
Active Directory Users and Computers
ADSI Edit
DNS
Group Policy Management

That’s it now your new win server 2008 domain controller with dns server setup was completed.

Original Article