Hey
i´m trying create a event receiver to publishing automatically documemnts when they are downloaded to sharepoint.
Imagine the situation, when i adding documents using the option open in browser... the documents are added to my Document Library but all of them are not publishing... i´m trying create a event receiver to do this automatically.
Take the code:
Error1Property or indexer 'Microsoft.SharePoint.SPFile.Level' cannot be assigned to -- it is read only
thanks for help
i´m trying create a event receiver to publishing automatically documemnts when they are downloaded to sharepoint.
Imagine the situation, when i adding documents using the option open in browser... the documents are added to my Document Library but all of them are not publishing... i´m trying create a event receiver to do this automatically.
Take the code:
public override void ItemAdding(SPItemEventProperties properties)
{
SPSecurity.RunWithElevatedPrivileges(delegate()
{
properties.Web.AllowUnsafeUpdates = true;
//properties.ListItem.ModerationInformation.Status = SPModerationStatusType.Approved;
properties.ListItem.File.Level = SPFileLevel.Published;
base.ItemAdding(properties);
properties.Web.AllowUnsafeUpdates = false;
});
} Error1Property or indexer 'Microsoft.SharePoint.SPFile.Level' cannot be assigned to -- it is read only
thanks for help