Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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

share|improve this question

1 Answer 1

up vote 3 down vote accepted

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());
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.