Reputation: 1077
I am currently adapting existing c# and trying to identify filetype from when a file is uploaded. The following
public override void ItemAdded(SPItemEventProperties properties)
{
commentscheck(properties);
}
The commentscheck function that is called from this function is attempting to verify what filetype something is.
I was wondering whether I could access something from SPItemEventProperties that would be able to tell me the filetype that has been uploaded?
Upvotes: 0
Views: 65
Reputation: 807
Check the properties.AfterUrl and split it.
public override void ItemAdded(SPItemEventProperties properties)
{
string[] FileTypeParts = properties.AfterUrl.Split(".");
string fileType = FileTypeParts [FileTypeParts .length-1];
string FileNameParts = properties.AfterUrl.Split("/");
string FileName = FileNameParts [FileNameParts .length-1];
commentscheck(properties);
}
Upvotes: 1