Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/261.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 使用C访问Sharepoint文件和文件类型#_C#_Sharepoint - Fatal编程技术网

C# 使用C访问Sharepoint文件和文件类型#

C# 使用C访问Sharepoint文件和文件类型#,c#,sharepoint,C#,Sharepoint,我目前正在修改现有的c#,并试图在上传文件时识别文件类型。以下 public override void ItemAdded(SPItemEventProperties properties) { commentscheck(properties); } 从该函数调用的commentscheck函数正在尝试验证文件类型 我想知道是否可以从SPItemEventProperties访问一些内容,这些内容可以告诉我已上载的文件类型?检查properties.

我目前正在修改现有的c#,并试图在上传文件时识别文件类型。以下

    public override void ItemAdded(SPItemEventProperties properties)
    {
        commentscheck(properties);
    }
从该函数调用的commentscheck函数正在尝试验证文件类型


我想知道是否可以从SPItemEventProperties访问一些内容,这些内容可以告诉我已上载的文件类型?

检查properties.AfterUrl并将其拆分

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);
}