Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

C# program that uploads files to sharepoint (409) Error  when using the  Microsoft.SharePoint.Client.File.SaveBinaryDirect

Posted on 2014-11-11
1
Medium Priority
?
917 Views
Last Modified: 2014-11-11
I keep getting 409 sharepoint error.  I dunno why when uploading files. code is below

 using (ClientContext clientContext = new ClientContext(SharePointRootURL())
                    {
                        clientContext.Credentials = GetSharePointCredentials();

                        var thisFileStream = System.IO.File.OpenRead(FilePath);

                        string FileName = System.IO.Path.GetFileName(FilePath);
                       
                        Microsoft.SharePoint.Client.File.SaveBinaryDirect(clientContext, String.Format(SharePointMemberPartnerReportLocation(), MemberPartnerFirmURL) + FileName, thisFileStream, true);
                       
                        thisFileStream.Close();
                    }
0
Comment
Question by:cbrune
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 32

Accepted Solution

by:
Jamie McAllister MVP earned 2000 total points
ID: 40436043
Is your code deffo putting a forward slash character between the MemberPartnerFirmURL and the Filename?

Since a 409 is about a rules conflict think about what rules may be being contravened. Are there existing files being overwritten?

http://www.checkupdown.com/status/E409.html
0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
When using a search centre, I'm going to show you how to configure Sharepoint's search to only return results from the current site collection. Very useful when using Office 365 with multiple site collections.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question