You'll have to forgive my ignorance with regards to deploying this code. I have written some code to modify an event reciever. I have set up a development environment for sharepoint. The development environment is now running fine without any issues. The following code is that which I would like to test.
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;
}
However how would I go about actually testing this code and event reciever on my development sharepoint environment.
Thanks,
Freddie