コード例 #1
0
ファイル: SPList.php プロジェクト: impensavel/spoil
 /**
  * Create a SharePoint List
  *
  * @param   SPSite $site       SharePoint Site
  * @param   array  $properties SharePoint List properties (Title, Description, ...)
  * @param   array  $settings   Instantiation settings
  * @throws  SPRuntimeException
  * @return  SPList
  */
 public static function create(SPSite $site, array $properties, array $settings = [])
 {
     $properties = array_replace_recursive(['BaseTemplate' => static::TPL_DOCUMENTLIBRARY], $properties, ['odata.type' => 'SP.List']);
     $body = json_encode($properties);
     $json = $site->request('_api/web/Lists', ['headers' => ['Authorization' => 'Bearer ' . $site->getSPAccessToken(), 'Accept' => 'application/json', 'X-RequestDigest' => $site->getSPContextInfo()->getFormDigest(), 'Content-type' => 'application/json', 'Content-length' => strlen($body)], 'query' => ['$expand' => 'RootFolder'], 'body' => $body], 'POST');
     return new static($site, $json, $settings);
 }
コード例 #2
0
ファイル: SPListObject.php プロジェクト: impensavel/spoil
 /**
  * {@inheritdoc}
  */
 public function getSPContextInfo()
 {
     return $this->site->getSPContextInfo();
 }