Class: Sharepoint::Folder
Instance Attribute Summary
Attributes inherited from Object
#parent
#data, #site, #updated_data
Instance Method Summary
collapse
Methods included from Type
#initialize
Methods inherited from Object
#copy, #destroy, #guid, #initialize, #reload, #save
#add_properties, #add_property, #available_properties, #initialize
Instance Method Details
#add_file(name, content) ⇒ Object
19
20
21
22
|
# File 'lib/sharepoint-files.rb', line 19
def add_file name, content
uri = "#{__metadata['uri']}/files/add(overwrite=true,url='#{URI::Parser.new.escape(name.to_s)}')"
@site.query :post, uri, content
end
|
#add_file_via_streaming(name, file) ⇒ Object
30
31
32
33
34
|
# File 'lib/sharepoint-files.rb', line 30
def add_file_via_streaming name, file
add_file name, nil
spo_file = file_from_name name
spo_file.upload_file_via_streaming file
end
|
#add_folder(name) ⇒ Object
24
25
26
27
28
|
# File 'lib/sharepoint-files.rb', line 24
def add_folder name
uri = "#{__metadata['uri']}/folders"
body = { '__metadata' => { 'type' => 'SP.Folder' }, 'ServerRelativeUrl' => name.to_s }
@site.query :post, uri, body.to_json
end
|
#file_from_name(name) ⇒ Object
15
16
17
|
# File 'lib/sharepoint-files.rb', line 15
def file_from_name name
@site.query :get, "#{__metadata['uri']}/files/getbyurl('#{URI::Parser.new.escape(name.to_s)}')"
end
|