예제 #1
0
        private static void Lae <T>(IEnumerable <T> objs, CmdLetContext ctx, bool andExecute, params Expression <Func <T, object> >[] retrievals) where T : ClientObject
        {
            var cObjs = objs.ToArray();

            for (int i = 0; i < cObjs.Length; i++)
            {
                var obj = cObjs[i];
                if (obj != null)
                {
                    try
                    {
                        ctx.Load(obj, retrievals);
                        if (andExecute)
                        {
                            ctx.ExecuteQuery();
                        }
                    }
                    catch (InvalidQueryExpressionException e)
                    {
                        if (e.Message.Contains("The query expression") && e.Message.Contains("is not supported"))
                        {
                            return;
                        }

                        else
                        {
                            throw new AggregateException("An invalid query was attempted.", e);
                        }
                    }
                }
            }
        }
예제 #2
0
 internal bool IsTenantAdminSite(CmdLetContext context)
 {
     try
     {
         new Tenant(context);
         context.ExecuteQuery();
         return(true);
     }
     catch (ServerUnauthorizedAccessException)
     {
         return(false);
     }
 }