开发者

'Share Publicly' in Google Storage using SharpGs

开发者 https://www.devze.com 2023-03-01 09:23 出处:网络
Using SharpGs as Google Storage cli开发者_JAVA百科ent in .NET, I tried this, but it isn\'t working:

Using SharpGs as Google Storage cli开发者_JAVA百科ent in .NET, I tried this, but it isn't working:

foreach (var o in bucket.Objects)
{
  o.Acl.CleanEntries();
  o.Acl.AddEntry(SharpGs.Acl.AclPermission.FULL_CONTROL, SharpGs.Acl.ScopeType.AllUsers);
  o.Acl.Save();
}


When you make "o.Acl" inside foreach, you are executing a query to server (it is inside getter of "Acl" property), so in each of 3 lines inside loop, you are fetching acl from server and resetting old value. So, you should make something like this:

var acl = o.Acl;
acl.CleanEntries();
acl.AddEntry(SharpGs.Acl.AclPermission.FULL_CONTROL, SharpGs.Acl.ScopeType.AllUsers);
acl.Save();
0

精彩评论

暂无评论...
验证码 换一张
取 消