Hi is there a way I can disable viewing of files that have been checked out?
We have a number of users on office 2003 and although the file when open is read only it doesn't tell the user this.
I have attempted an event handler to accomplish this but it doesn't work
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;
namespace MyEventHandler
{
public class ItemUpdatingHandler : SPItemEventReceiver
{
public override void ItemUpdating(SPItemEventProperties properties)
{
base.DisableEventFiring();
try
{
SPFile file = properties.ListItem.File;
if ((file.CheckOutStatus == SPFile.SPCheckOutStatus.LongTerm) ||
(file.CheckOutStatus == SPFile.SPCheckOutStatus.LongTermOffline))
properties.ErrorMessage = "This file is locked for editing, please try again later " + properties.ListItem.File;
}
catch { }
finally
{
base.EnableEventFiring();
}
}
}
}
We have a number of users on office 2003 and although the file when open is read only it doesn't tell the user this.
I have attempted an event handler to accomplish this but it doesn't work
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;
namespace MyEventHandler
{
public class ItemUpdatingHandler : SPItemEventReceiver
{
public override void ItemUpdating(SPItemEventProperties properties)
{
base.DisableEventFiring();
try
{
SPFile file = properties.ListItem.File;
if ((file.CheckOutStatus == SPFile.SPCheckOutStatus.LongTerm) ||
(file.CheckOutStatus == SPFile.SPCheckOutStatus.LongTermOffline))
properties.ErrorMessage = "This file is locked for editing, please try again later " + properties.ListItem.File;
}
catch { }
finally
{
base.EnableEventFiring();
}
}
}
}