Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Customizing SharePoint Context Menus

  Asked By: Gurupreet    Date: Jan 31    Category: Sharepoint    Views: 2540

I have a web part to copy a document (files only not folders) from one
document library to another doc library. I have customize "SharePoint
Context Menus" reference
blogs.msdn.com/bowerm/articles/175691.aspxand added a "copy"
menu. If I select any file, it works but if there is a
folder inside a document library, it doesn't.

So how can I find out whether a selected item is a folder/file? And if it is
a folder, I do not want to display "copy" item in the SharePoint Context
Menu List.

Thanks in advance and here is code of what I have done so far.

<script language="javascript">

function Custom_AddDocLibMenuItems(m, ctx)
var strDisplayText = "Copy";
var strAction;
var strImagePath = "";

var fileDirPath;
var fileOrDir_Name;
var dotIndex;

HOST_NAME = window.location.hostname
fileDirPath = itemTable.ServerUrl;
//alert("ctx.HttpRoot: " + ctx.HttpRoot);

fileOrDir_Name = fileDirPath.substring(fileDirPath.lastIndexOf('/')+1)
dotIndex = fileOrDir_Name.indexOf('.');

if (fileDirPath != "" && dotIndex != -1)
strAction = 'window.navigate("

// Add menu item
CAMOpt(m, strDisplayText, strAction, strImagePath);

// add a separator to the menu

return false; // this enables the rest of the menu items to be rendered.




No Answers Found. Be the First, To Post Answer.

Didn't find what you were looking for? Find more on Customizing SharePoint Context Menus Or get search suggestion and latest updates.