Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

C# code to copy files to a Sharepoint site

$
0
0

I'm new to both sharepoint and some C# experience.

I'm looking for c# code to  simply copy a file to a sharepoint site.  Currently doing something like this:

      string siteURL = "https://myurl/dept/Test/Documents";
      ClientContext context = new ClientContext(siteURL);NetworkCredential _myCredentials =

                   new  NetworkCredential("me", "mypassword", "mydomain");

      context.Credentials = _myCredentials;

Without going any further right off the bat I get

Microsoft.SharePoint.Client.ClientContext}
    ApplicationName: ".NET Library"
    AuthenticationMode: Default
    ClientTag: null
    Credentials: null
    DisableReturnValueCache: false
    FormDigestHandlingEnabled: true
    FormsAuthenticationLoginInfo: null
    HasPendingRequest: false
    PendingRequest: {Microsoft.SharePoint.Client.ClientRequest}
    RequestResources: {Microsoft.SharePoint.Client.RequestResources}
    RequestSchemaVersion: {15.0.0.0}
    RequestTimeout: 180000
    ServerLibraryVersion: 'context.ServerLibraryVersion' threw an exception of type 'Microsoft.SharePoint.Client.PropertyOrFieldNotInitializedException'
    ServerSchemaVersion: 'context.ServerSchemaVersion' threw an exception of type 'Microsoft.SharePoint.Client.PropertyOrFieldNotInitializedException'
    ServerVersion: 'context.ServerVersion' threw an exception of type 'Microsoft.SharePoint.Client.PropertyOrFieldNotInitializedException'
    ServiceRelativeUrl: "_vti_bin/client.svc/ProcessQuery"
    Site: {Microsoft.SharePoint.Client.Site}
    StaticObjects: Count = 1
    Tag: null
    TraceCorrelationId: null
    Url: "https://myurl/dept/Test/Documents"
    ValidateOnClient: true
    Web: {Microsoft.SharePoint.Client.Web}
    WebRequestExecutorFactory: {Microsoft.SharePoint.Client.DefaultWebRequestExecutorFactory}

Any code sample help would be much appreciated


Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>