public string IsAttachmentCheckedOut(int itemID, int myListID)
{
string ErrorMsg = string.Empty;
Guid lguid = new Guid(myListID);
SPList mlist = SPContext.Current.Web.Lists[lguid];
SPFolder mfolder = mlist.GetItemById(itemID).Folder;
foreach (SPFile file in mfolder.Files)
{
if (file.CheckOutType != SPFile.SPCheckOutType.None)
{
string currentUser = SPContext.Current.Web.CurrentUser.Name;
if
(file.CheckedOutByUser.Name.ToLower().Equals(currentUser.ToLower()))
{
ErrorMsg += "The Attachment, '" + file.Name + "'
is Checked Out by You.\\r\\n";
}
else
{
ErrorMsg += "The Attachment, '" + file.Name + "'
is Checked Out by the User, '" +
file.CheckedOutByUser.Name.ToUpper() + "'.\\r\\n";
}
}
}
return ErrorMsg;
}
No comments:
Post a Comment