Tuesday, May 19, 2009

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 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.

Monday, January 5, 2009

Catch the exception caused by massive file size upload in asp.net 2.0

Put the code in Global.asax under c:\Inetpub\wwwroot\wss\VirtualDirectories\80

void Application_Error(object sender, EventArgs e)

{

//To catch the error caused by masssive file size upload more than 4MB.

HttpException httpEx = Server.GetLastError() as HttpException;

if(httpEx.ErrorCode == -2147467259)

{

HttpContext.Current.Server.ClearError ();

HttpContext.Current.Server.Transfer("ErrorMessage.aspx");

}

}

Friday, January 2, 2009

Few Interesting Things about IIS6

  1. While uploading, IIS6 never returns any error until it completely absorbs the uploaded file.

Tuesday, November 25, 2008

Enable Session in SharePoint

In Web.Config file, modify the following string.

<pages enableSessionState="true" enableViewState="true" enableViewStateMac="true" validateRequest="false" />


<!--<add name="Session" type="System.Web.SessionState.SessionStateModule"/> -->
Change into:

<add name="Session" type="System.Web.SessionState.SessionStateModule"/>


 

Wednesday, September 3, 2008

Problem in adding reference of assemblies of GAC?

You can find any dll in gac at local path as given below:

C:\WINDOWS\assembly\GAC_MSIL\<Name of dll>\1.0.0.0__0fcde578cc202cae\<Name of dll>.dll

Note: 1.0.0.0__0fcde578cc202cae is the version name and it differs assembly to assembly.

Thursday, July 31, 2008

Very good Caml Query Builder

http://www.u2u.info/Blogs/karine/Lists/Posts/Post.aspx?ID=28

Sharepoint Tools : Must have


*PowerShell Script Generator*
http://www.microsoft.com/resources/TechNet/en-us/Office/media/WindowsPowerShell/WindowsPowerShellCommandBuilder.html

Performance Measurement Tools
DynaTrace
http://www.compuware.com/application-performance-management/dynatrace-test-center.html
Load Runner
http://www8.hp.com/us/en/software-solutions/software.html?compURI=1175451#.UTTRvqKOQy0

Code Maintainance tool(Code ReSharper-)
http://www.jetbrains.com/resharper/

* Online HTML ENCODER*
http://www.opinionatedgeek.com/dotnet/tools/htmlencode/Encode.aspx

*All Connection String Samples*
http://www.connectionstrings.com/

Tools by SysInternals
================
Process Monitor
More details here - http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx

and many more here - http://technet.microsoft.com/en-us/sysinternals/bb545027

CamStudio - Captures activity on the screen
=================================
http://download.cnet.com/CamStudio/3000-13633_4-10067101.html


1. Internet Explorer Developer Toolbar : Very good tool for web development
http://www.microsoft.com/DownLoads/details.aspx?familyid=E59C3964-672D-4511-BB3E-2D5E1DB91038&displaylang=en
Steps to enable IEToolbar:

1. Tools-->Internet options --> Security Tab --> Local Intranet --> Custom Level --> Run ActiveX Control or PlugIn (Administrator Mode)

2. Tools --> Internet Options --> Programs --> Manage add-ons --> IE Developer Toolbar --> Enable

3. Tools --> Internet Options --> Advanced --> Enable third party browser-extensions 2. Color Picker
Download "pixiesetup.exe"
3. WebDevelopment Helper
Download "WebDevHelper.msi"
4. U2U caml query builder
Download "U2UCamlCreator.exe"
5. Fiddler
Download "FiddlerSetup.exe"
6. Reflector
Download "Reflector.zip"
7. WSS SDK
Download "wsssdk.exe"

8. SharePoint Solution Generator
Download "VSeWSS.exe"
9. VS2008 WSS Extensions
Download "VSeWSSv12.exe"
10. VS2005 extension for WWF
Download "Visual Studio 2005 Extensions for Windows Workflow Foundation (EN).exe"

Tuesday, July 29, 2008

Session.SessionID uniqueness.

Session.SessionID is unique only after there is some value stored in session.

Otherwise it always give different id at every postback.

Wednesday, July 16, 2008

How to Disable refresh button in web page

// Disable F5 button to disable refresh.

function checkKeyCode(evt)

{


 

var evt = (evt) ? evt : ((event) ? event : null);

var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);

if(event.keyCode==116)

{

evt.keyCode=0;

return false

}

}

document.onkeydown=checkKeyCode;


 


 

//Disable Right click

function Disable()

{

if (event.button == 2)

{

return false;

}

}

document.onmousedown=Disable;


 

Note: We cant control the refresh button of browser in general ways.