A while ago I posted about using Visual Studio to performance and stress test your SharePoint environment. A few people have posted comments about an error they face; this error is also prevalent on the Microsoft forums as well. I actually had one of my colleagues ask me how to fix this exact error today and remembered that I had not yet posted this. So here goes for those of you who get the following error after recording let's say a document upload in SharePoint this is the workaround I use.
Firstly let's look at what Visual Studio outputs to the recoding pane within internet explorer.
Some of the lines above are not needed; this list above is the recording of the following steps:
- Access Home Page
- Access team site called "SampleTestSite"
- Access the "Shared Documents" library
- Click the "Upload" button in the document library
- Select a test document and then upload
- Confirm the content type and then save
The most important line that we need in this test is the line showed below:
To fix the problem there are a couple of things you can do, the first is to check the name of the "Extraction Parameter" within the recoding.
If you check the properties, you might find it is named something like the below:
Simply rename this to "1" and your "HIDDEN1.__EVENTTARGET" will work. The thing to remember is that the field call to "$HIDDEN1" is actually simply concatenating the word "$HIDDEN" and the "Extraction Parameter" name together. CHECK THIS ONE FIRST!!
The other alternative is to reconstruct some of the code manually, some of this you will need to do anyway to make it work correctly. Remove the following line from the recording pane in Visual Studio.
Once we have removed the highlighted lines the recording should look like the following:
Now we have stripped our recording to the bare minimum, we need to copy the "Upload" line.
Simply paste this and it will show up below the first "Upload" line.
So now we have two lines for uploading we need to modify the second line slightly, firstly remove the extraction rule as this is done in the previous line.
Once this line has been removed we need to add some "Form Post Parameters".
The list of parameters is shown below:
Once we have these added your project should now work and not error with the error shown above. Whichever way you fix the problem when the project is run it should look something like this: