Overwriting file in SharePoint in C #

0

I have a method that inserts a file in SharePoint using

RootFolder.Files.Add(file)

so I want to have the option to overwrite the file with only the URL.

    
asked by Nestor Eduardo 23.01.2017 в 16:55
source

1 answer

3

The RootFolder.Files.Add method has an overload that receives a Boolean that specifies when to overwrite files with the same name.


SPFileCollection.Add method (String, Byte [], Boolean)

public SPFile Add(
    string urlOfFile,
    byte[] file,
    bool overwrite
)

Parameters:

  
  • urlOfFile
      Type: System.String
      The relative URL of the file.
  •   
  • file
      Type: []
      An array of bytes that contains the file.
  •   
  • overwrite
      Type: System.Boolean
    true to overwrite a file with the same name; false does not overwrite.
  •   
    
answered by 23.01.2017 / 18:11
source