0

How to call Site.ProvisionMigrationContainers()?

When I call this method it returns an empty list, when it should not. It returns immediately, which is indicative of the fact that it did nothing. What is the procedure to execute this method?

EDIT: I'm using c#

  • What are you using? C# or JavaScript? JSOM, CSOM, SSOM? – helb Nov 7 '18 at 15:32
  • documentation says it puts an item on a queue: msdn.microsoft.com/en-us/library/… – Derek Gusoff Nov 7 '18 at 15:52
  • It initilizes the Azure Containers and returns their urls so that you can put items on the queue with CreateMigrationJob – user77232 Nov 7 '18 at 18:31
0

Sigh, I figured it out. I had to use Jetbrains dotPeek to look at the code for the SharePoint.Client library.

        public static ClientResult<ProvisionedMigrationContainersInfo> GetContainer() {
        Uri _targetUrl = new Uri("https://companyname.sharepoint.com/sites/MySite"); //target sharepoint online site

        ClientContext _context = new ClientContext(_targetUrl);
        //look up credentials in windows credential store, not necessary for hard coded passwords
        Credential _creds = new Credential() { Target = "companyname.sharepoint.com" };
        if (_creds.Exists()) {
            _creds.Load();
        }
        else {
            throw new ApplicationException("Credentials Not Found");
        }
        _context.Credentials = new SharePointOnlineCredentials(_creds.Username, _creds.SecurePassword);
        //make the call to the method. The method returns an object with the value property unpopulated.
        ClientResult<ProvisionedMigrationContainersInfo> _migrationContainers = _context.Site.ProvisionMigrationContainers();
        //which only gets populated after ExecuteQuery
        _context.ExecuteQuery();
        //the urls are now populated
        return _migrationContainers;
    }

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.