Wednesday, April 29, 2009

Lookup fields processing in custom activity

If you are using SharepointWorkflows with some custom activities you might face this problem.

In your custom activities, you might need dynamic content input from user while creating workflows.

Mail text would be the best example for the same.

In custom activity such as mail send with attachments, needs dynamic content.

For example,

Hi [%List:Username%]

.....

......

Thanks,

[%List:Sender%]

This kind of dynamic content will not be parse if you directly use the input parameter without Helper.ProcessStringField.

Without this processing custom activity will treat it as a string. and and in mail you will get Hi [%List:Username%] text. (instead of Hi Indrajeet..)

So to fix of the problem, 

before using the input in mailsend function you should procees it by using Helper.ProcessStringField(stringFromUserInput, objActivity, this.__Context))

Ex. String retValue = Helper.ProcessStringField(stringFromUserInput, objActivity, this.__Context))


Virtual paths for layouts and theme folders

For themes :

/_Themes/Folder1/test.css

For Layouts :

/_Layouts/Folder2/Page1.aspx

Wednesday, April 22, 2009

Wednesday, April 1, 2009

Hide sharepoint Contextmenu(ECB)/ Remove sharepoint Contextmenu(ECB)

Core.Js findings:

  1. In Core.Js, under path C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\1033

function AddSharedNamespaceMenuItems creates following context menu items.

View Item,

Edit Item,

Manage Permissions

You can override the functions in MasterPage to modify the context menu.

  1. To Hide context Menu in sharepoint. Override following function of core.js.

    AddListMenuItems -- Hides Context Menu from list.


 

For more details mail me at indrajitk@gmail.com


 

Steps to hide Context menu for list items:


 

1. Just go to core.js file(C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\1033)

2. find AddListMenuItems function.

3. You will find following code in this function, if (typeof(Custom_AddListMenuItems) !="undefined") { if (Custom_AddListMenuItems(m, ctx)) return; }

4. You can override AddListMenuItems function by Implementing Custom_AddListMenuItems(m, ctx) function in any global place(I did it in master page.). Do not put any code in this function except return false True;

5. No context menu will be displayed for list items.