How To Get Sharepoint Online Migration API Logs (using c#)

  • Thread starter Thread starter Titus Nachbauer
  • Start date Start date
T

Titus Nachbauer

Guest
Using the `Sharepoint.Client` version 16 package, we are trying to create a `MigrationJob` in c# and then subsequently want to see the status and logs of that migration job. We managed to provision the containers and queue using the `ProvisionMigrationContainers` and `ProvisionMigrationQueue` methods on the `Site` object. And we managed to upload some files and manifest XMLs. These XMLs still contain some errors in the ids and structure, so we expect the job to fail. However, we still expect the job to be created and output some messages and logs. Unfortunately the message queue seems to be empty and the logs are nowhere to be found (at least we can't find them). The Guid of the created migration job is the null guid: `00000000-0000-0000-0000-000000000000`

According to SharePoint Online Migration API Overview the logs should be saved in the manifest container as a blob. But how would you actually find the name of the log file? The problem is that everything has to be encrypted and it is not allowed to list the blobs in the blob storage (trying this leads to a 403 error).

So the main question is: how are we supposed to access the log files? And the bonus question: assuming that the command to create the migration job is correct, why are we getting the null guid? And last one: why is the queue empty? I could speculate that the migration job is never created and that's why the guid is all zeroes, but how are we supposed to know what is preventing the job from being created?

Here is the code that creates the Migration Job:

public ClientResult<Guid> CreateMigrationJob()
{
var encryption = new EncryptionOption
{
AES256CBCKey = encryptionProvider.Key
};
return context.Site.CreateMigrationJobEncrypted(
context.Web.Id,
dataContainer.Uri.ToString(),
metadataContainer.Uri.ToString(),
migrationQueue.Uri.ToString(),
encryption
);
}
`context`, `dataContainer`, `metadataContainer` have all been properly instantiated as members and have been used in other methods successfully. `migrationQueue` and `encryption` also look fine, but have not been used elsewhere. The encryption key has been used to upload and download files though and works perfectly fine there.

For completeness sake, here is the code we tried to use to check if there is anything in the queue:

public void GetMigrationLog()
{
while (migrationQueue.ApproximateMessageCount > 0) //debug code, this should be done async
{
Console.WriteLine(migrationQueue.GetMessage().AsString);
}
}
It outputs nothing, because the queue is empty. We would expect there to be at least an error message or a message that the logs were created (including the name of the log file).

Continue reading...
 
Back
Top