4

I was wondering if their is any way to convert ClientRuntimeContext into ClientContext. i am retrieving the ClientRuntime context like this

    public File uploadBase(Document document, Folder folder)
    {
        ClientRuntimeContext clientContext = folder.Context;
    }

The reason for this question is that i am building a productivity layer ontop of the Client-object-model, and trying to make it as easy to use as possible

Thanks in advance

6

ClientContext is derived from ClientRuntimeContext. You can safely cast one to the other.

public File uploadBase(Document document, Folder folder)
{
    ClientRuntimeContext clientContext = (ClientContext)folder.Context;
}

Tried it out here and it worked for downloading files:

var fileInformation = File.OpenBinaryDirect((ClientContext)item.Context, item["FileRef"].ToString());

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.