0
votes

So we have created an updated version of a WSP for SharePoint 2010 due to our migration/update from 2007 to 2010.

The WSP is a event handler/reciever for ItemAdded() and we have it working as intended. Issue is that the operation seems to only work for one computer/machine and no others.

When the Item is Added to a list the WSP creates a Folder in Shared Documents library, creates a wiki page, then updates the new List Item with links to the Shared Doc and Wiki.

When triggered by Machine #1 and User #1 all operations work, when Machine #2(M2) and user #2(U2) or M3 and U3 non of the tasks take place when a new Item is created.

User #2 can log in on M1 and create a new item and all operations work. But if U1 uses M2 or M3 to create an item the events don't trigger. Machine #1 is able to trigger the event as many times as they want but no other computer is able to.

If you were able to follow is it something with the code or some sort of cache setting on the local machine or the SP server, or something else? Any help is appreciated.

Update: All machines are on the same network. Non of the machines are the server but various personal laptops. Development was done on a separate machine. All are accessing via the same URL. All users have same access. This is on our test site currently which would be switched to being production once migration/upgrade takes place.

Before current .WSP deployment we noticed the same issue but it was reverse, Machine #2 did all the updates but Machine #1 and #3 couldn't. Only thing we can think of was that those machines were the first to trigger the event after deployment.

I'm Not doing the .WSP install but our IT guy is(won't let us have access :/ but I understand) but below is the install commands he is running.

Add-SPSolution -LiteralPath "OurPath/ourFile.wsp"

Install-SPSolution -Identity ourIdentity -WebApplication http://myhost.com/ -GACDeployment

Below is the main part of the code

public class CreateWikiAndFolder : Microsoft.SharePoint.SPItemEventReceiver
{
    public override void ItemAdded(SPItemEventProperties properties)
    {
        try
        {
            //this.DisableEventFiring();
            base.EventFiringEnabled = false;
            string sUrlOfWikiPage = string.Empty;
            string sUrlOfNewFolder = string.Empty;
            string sSubsiteRUL = string.Empty;
            string sCurrentItemTitle = properties.ListItem["Title"].ToString();
            string sWikiListName = "TR Wikis";
            string sDocLibName = "Shared Documents";
            string sTRListID = "TR Status";

            if (sTRListID.ToUpper().Equals(properties.ListTitle.ToString().ToUpper()))
            {
                //Create the Folder
                sUrlOfNewFolder = CreateFolder(properties.ListItem.Web, sDocLibName, sCurrentItemTitle);

                //Create the Wiki
                string ItemDispFormUrl = String.Concat(properties.ListItem.Web.Url, "/", properties.ListItem.ParentList.Forms[PAGETYPE.PAGE_DISPLAYFORM].Url, "?ID=", properties.ListItem.ID.ToString());
                sUrlOfWikiPage = CreateWiki(properties.ListItem.Web, sWikiListName, sCurrentItemTitle, ItemDispFormUrl, sUrlOfNewFolder);


                //Update the current TR Item
                SPWeb myWeb = properties.ListItem.Web;
                myWeb.AllowUnsafeUpdates = true;

                SPListItem myListItem = properties.ListItem;
                SPFieldUrlValue shareFolderURLValue = new SPFieldUrlValue();
                shareFolderURLValue.Description = "Shared Folder";
                shareFolderURLValue.Url = sUrlOfNewFolder ;
                myListItem["SharedFolder"] = shareFolderURLValue;

                myListItem.Update();

                myWeb.AllowUnsafeUpdates = false;
            }
            base.EventFiringEnabled = true;  
        } 
        catch (Exception e)
        {
         //Currently throwing nothing
        }
    }
}
2
You can improve this question by adding the following information: Are those 3 machines on the same network segment? Is Machine #1 the place where you developed the solution? Is Machine #1 a server? Do you have different zones (URLs) to access the same web application? What permissions does each user has? How did you deployed your WSP (Farm or Sandbox)? Sharing part of the code would be helpful.Isaac E. Krauss
Thanks, Added above too. All machines are on the same network. Non of the machines are the server but various personal laptops. Development was done on a separate machine. All are accessing via the same URL. All users have same access. This is on our test site currently which would be switched to being production once migration/upgrade takes place. Before current .WSP deployment we noticed the same issue but it was reverse, Machine #2 did all the updates but Machine #1 and #3 couldn't. Only thing we can think of was that those machines were the first to trigger the event after deployment.MTCLMBR

2 Answers

0
votes

It could be a hardcoded path/url, however there is not enough information to identify the problem, I would be glad to update my answer with a more detailed theory if you provide more details or if you share some of your code.

0
votes

Figured out the issue. I didn't include them with the above file code. But we were StreamWriting to a text file on the server to help us with debugging. Issue was with that, When user 1 was logged on their machine and the log files didn't exist, they would get generated. Now no other users then had read/write access to those files and so it errored out at our debug files for anyone else. But that Windows user could run it as much as they wanted as they were the owner of the file :/