Saturday, October 31, 2009

Windows 2008 Server - Deploy Dll in Gac

1. Go to start --> Command Prompt as Administrator --> "explorer %windir%\assembly"
2. Open second command prompt. Go to start --> Command Prompt as Administrator --> "
explorer [path to directory where the dll is located]"
3. Drag drop the dll from the source directory to the GAC. Thats done.

Thursday, October 29, 2009

Custom activity with full code for creating folder in list/Library with action file code

Code:
using System;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Collections;
using System.Drawing;
using System.Linq;
using System.Workflow.ComponentModel.Compiler;
using System.Workflow.ComponentModel.Serialization;
using System.Workflow.ComponentModel;
using System.Workflow.ComponentModel.Design;
using System.Workflow.Runtime;
using System.Workflow.Activities;
using System.Workflow.Activities.Rules;
using Microsoft.SharePoint;



namespace CreateFolder
{
public partial class Activity1 : Activity
{

public static DependencyProperty FolderNameProperty
= DependencyProperty.Register(
"FolderName", typeof(string), typeof(Activity1));

[DescriptionAttribute("FolderName")]
[CategoryAttribute("FolderName Category")]
[BrowsableAttribute(true)]
[DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible)]
public string FolderName
{
get
{
return ((string)(base.GetValue(Activity1.FolderNameProperty)));
}
set
{
base.SetValue(Activity1.FolderNameProperty, value);
}
}

public static DependencyProperty BaseUrlProperty
= DependencyProperty.Register("BaseUrl", typeof(string), typeof(Activity1));

[DescriptionAttribute("BaseUrl")]
[CategoryAttribute("BaseUrl Category")]
[BrowsableAttribute(true)]
[DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible)]
public string BaseUrl
{
get
{
return ((string)(base.GetValue(Activity1.BaseUrlProperty)));
}
set
{
base.SetValue(Activity1.BaseUrlProperty, value);
}
}

public static DependencyProperty ListNameProperty
= DependencyProperty.Register("ListName", typeof(string), typeof(Activity1));

[DescriptionAttribute("ListName")]
[CategoryAttribute("ListName Category")]
[BrowsableAttribute(true)]
[DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible)]
public string ListName
{
get
{
return ((string)(base.GetValue(Activity1.ListNameProperty)));
}
set
{
base.SetValue(Activity1.ListNameProperty, value);
}
}


public static DependencyProperty InvokeEvent
= DependencyProperty.Register("Invoke", typeof(EventHandler), typeof(Activity1));

[DescriptionAttribute("Invoke")]
[CategoryAttribute("Invoke Category")]
[BrowsableAttribute(true)]
[DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible)]
public event EventHandler Invoke
{
add
{
base.AddHandler(Activity1.InvokeEvent, value);
}
remove
{
base.RemoveHandler(Activity1.InvokeEvent, value);
}
}

public Activity1()
{
InitializeComponent();
}

protected override ActivityExecutionStatus
Execute(ActivityExecutionContext executionContext)
{
// Raise Invoke Event to execute custom code in the workflow.
this.RaiseEvent(Activity1.InvokeEvent,
this, EventArgs.Empty);

string strIndrajeet = FolderName;
string strBaseUrl = BaseUrl;
string strDocLibName = ListName;

SPSite spsite = new SPSite(strBaseUrl);

spsite = new SPSite(strBaseUrl, spsite.SystemAccount.UserToken);
using (SPWeb spweb = spsite.OpenWeb())
{
spsite.AllowUnsafeUpdates = true;
spweb.AllowUnsafeUpdates = true;

SPFolderCollection folders = spweb.GetFolder(strBaseUrl + "/" + strDocLibName).SubFolders;

bool boolFolderNotCreated = true;

if (!spweb.GetFolder(strBaseUrl + "/" + strDocLibName + "/" + strIndrajeet).Exists)
{
folders.Add(strIndrajeet);
boolFolderNotCreated = false;
spweb.Update();
}

int count = 1;
while (boolFolderNotCreated)
{
string folderName = strIndrajeet + "_" + Convert.ToString(count);
SPFolder spfTemp = spweb.GetFolder(strBaseUrl + "/" + strDocLibName + "/" + folderName);
if (!spfTemp.Exists)
{
folders.Add(folderName);
boolFolderNotCreated = false;
spweb.Update();
}
else
{
count++;
boolFolderNotCreated = true;
}
}
}

// Indicate that the activity has completed.
return ActivityExecutionStatus.Closed;
}
}
}

<strong>.Aciton file entry (under C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\1033\Workflow)</strong>
<blockquote></blockquote>""""


<workflowinfo>
<actions parallel="and" sequential="then">
<action category="List Actions" appliesto="all" assembly="CreateFolder, Version=1.0.0.0, Culture=neutral, PublicKeyToken=effbcf4c7d0dab8e" classname="CreateFolder.Activity1" name="Create Folder">
<ruledesigner sentence="Create Folder in List %2 with folder name %1 under site %3">
<fieldbind id="1" designertype="TextArea" field="FolderName">
<fieldbind id="2" designertype="TextArea" field="ListName">
<fieldbind id="3" designertype="TextArea" field="BaseUrl">
</ruledesigner>
<parameters>
<parameter name="FolderName" direction="In" type="System.String, mscorlib">
<parameter name="ListName" direction="In" type="System.String, mscorlib">
<parameter name="BaseUrl" direction="In" type="System.String, mscorlib">
</parameters>
</action>
</actions>
</workflowinfo>

<strong>Web.Config Entry</strong>
<authorizedtype assembly="CreateFolder, Version=1.0.0.0, Culture=neutral, PublicKeyToken=effbcf4c7d0dab8e" authorized="True" typename="*" namespace="">

Tuesday, October 13, 2009

A very good link for image search in Sharepoint

http://blogs.catapultsystems.com/matthew/archive/2008/08/28/sharepoint-image-search-part-1.aspx

How to crawl the content in sharepoint search

1. Go to Central Admin--> Shared Services--> Search Settings --> Content sources and crawl schedules

2. Shared Services Administration: SharedServices1 > Search Administration > Content Sources

3. Local Office SharePoint Server sites

4. Start Full Crawl

Thursday, October 1, 2009

Single Sign On Help

http://www.thorprojects.com/blog/archive/2008/08/02/moss-single-sign-on-setup-step-by-step.aspx

My Site help

http://technet.microsoft.com/en-us/library/cc261864.aspx

Important Paths for Creating custom theme in sharepoint

SpThemes.Xml -- C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\1033
Theme folders -- C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\THEMES
mycustomtheme.gif - C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\IMAGES