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
17
18
19
20
|
# File 'lib/sharepoint-files.rb', line 17
def add_file name, content
uri = "#{__metadata['uri']}/files/add(overwrite=true,url='#{URI::encode(name.to_s)}')"
@site.query :post, uri, content
end
|
#add_folder(name) ⇒ Object
22
23
24
25
26
|
# File 'lib/sharepoint-files.rb', line 22
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
13
14
15
|
# File 'lib/sharepoint-files.rb', line 13
def file_from_name name
@site.query :get, "#{__metadata['uri']}/files/getbyurl('#{URI::encode(name.to_s)}')"
end
|