您将不得不原谅我对部署此代码的无知。我已经编写了一些代码来修改事件接收者。我已经为共享点建立了一个开发环境。开发环境现在运行良好,没有任何问题。以下代码是我要测试的代码。
private void commentscheck(SPItemEventProperties properties)
{
bool commentsorrevisions = false;
if (!properties.AfterUrl.EndsWith("docx"))
{
commentsorrevisions = WordCommentsChecker(fileobject);
}
elif (!properties.AfterUrl.EndsWith("xlsx"))
{
commentsorrevisions = ExcelCommentsChecker(fileobject);
}
else:
return true;
private static bool WordCommentsChecker(string filename)
{
bool outcome = false;
Word.Application wordApp = new Word.Application();
Word.Document document = wordApp.Documents.Open(filename);
int commentscount = document.Comments.Count;
int revisionscount = document.Revisions.Count;
if (commentscount != 0 || revisionscount != 0)
{
Console.WriteLine("comments");
document.ActiveWindow.Close();
wordApp.Application.Quit(-1);
outcome = true;
}
else
{
Console.WriteLine("No Comments.");
document.ActiveWindow.Close();
wordApp.Application.Quit(-1);
outcome = false;
}
return outcome;
}
但是,我将如何在开发共享点环境中实际测试此代码和事件接收器。
谢谢
Freddie