0
votes

I am current coding a custom web service for a Sharepoint 2010 site. This code is designed to copy the contents of one folder to another on sharepoint.

Currently, my code uses 'SPSite(SourceURL).openWeb()' to get access to an SPWeb object for the site. However, my code crashes and gives me the following error

The Web application at 'SourceURL' could not be found. Verify that you have typed the URL correctly. If the URL should be serving existing content, the system administrator may need to add a new request URL mapping to the intended application.

In my code, SourceURL is the URL of the main site formatted as "https://sitename.com".

Thanks for any help,
Scott

EDIT: Here is the method that causes the error:

public void CopyFolderContents(String sourceURL, String folderURL, String destinationURL)
    {
        using (SPWeb oWebsite = new SPSite(sourceURL).OpenWeb())
        {
            SPFolder oFolder = oWebsite.GetFolder(folderURL);

            //Create a list of all files (not folders) on the current level
            SPFileCollection collFile = oFolder.Files;

            //Copy all files on the current level to the target URL
            CopyToTarget(collFile, destinationURL);

            //Create a list of all folders on the current level
            SPFolderCollection collFolder = oFolder.SubFolders;

            //Copy each of the folders and all of their contents
            EnumerateFolders(collFolder, destinationURL);

        }
    }
1
Is this application being deployed on a sharepoint server? Does your user have farm-admin rights or is he the account running the websites?TGlatzer
The web service has been deployed on the server. The user accessing the web service does not have farm-admin rights but does have full control permissions on every site collection accessedScott
I can post the code for my custom web service as well if it helpsScott
We often had a problem with these accounts not being farm admin, if you try to use the server ObjectModel. Try to use powershell with that user - it will probably not work either.TGlatzer
Unfortunately, I don't have the ability to run powershell on sharepoint with this user as it is a specially set up Active Directory account for our CRM server. I'll check with our server admin to see if he can do it.Scott

1 Answers

0
votes

It seems that your web service is not running in 64bit application pool. SharePoint throws that exception if the process using the API is not running as 64bit. Also unsure to compile the project using the correct bitness. See this or this.