Skip to content

Commit

Permalink
Merge pull request #61 from blizzz/sp_save_file_add_digest
Browse files Browse the repository at this point in the history
Add digest to file save request, SP refuses the operation otherwise
  • Loading branch information
vgrem authored Apr 19, 2017
2 parents f9dd2ed + 68bcd5f commit 9a866ba
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/SharePoint/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@ public static function saveBinary(ClientRuntimeContext $ctx, $serverRelativeUrl,
$request->Method = HttpMethod::Post;
$request->addCustomHeader('X-HTTP-Method','PUT');
$request->Data = $content;
if($ctx instanceof ClientContext) {
$ctx->ensureFormDigest($request);
}
$ctx->executeQueryDirect($request);
}

Expand Down Expand Up @@ -245,4 +248,4 @@ function setProperty($name, $value, $persistChanges = true)
$this->setResourceUrl("Web/GetFileById(guid'{$value}')");
}
}
}
}

0 comments on commit 9a866ba

Please sign in to comment.