开发者

'Share Publicly' in Google Storage using SharpGs

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜