0

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

0

Insert a breakpoint to your event receiver, press F5 to debug. enter image description here

OR:

Go to %windir%\system32\inetsrv in cmd, find your web application process. enter image description here

Attach the process and debug.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.