示例#1
0
        /// <summary>
        /// Validates parameter input before processing the pipeline.
        /// </summary>
        /// <remarks>
        /// This method gets called once for each cmdlet in the pipeline when the pipeline starts executing (before the process block of any other command).
        /// </remarks>
        protected override void BeginProcessing()
        {
            if (!PoshBoxAuth.IsInitialized)
            {
                ThrowTerminatingError(
                    new ErrorRecord(
                        new Exception("No Box configuration found. Use Connect-Box to import a configuration."),
                        "9000",
                        ErrorCategory.InvalidOperation,
                        null
                        ));
            }

            if (Array.Exists(Properties, name => name == "*"))
            {
                Properties = BoxUserPropertyNameCompleter.AllPropertyNames;
            }

            fieldNames = PropertyUtility.GetPropertyNames(typeof(BoxUser), Properties);

            SearchUser = (SearchUser == "*") ? null : SearchUser;

            UserType = UserType.ToLower();

            WriteVerbose("Using admin client already established: " + PoshBoxAuth.BoxConfiguration.ClientId);
            client = PoshBoxAuth.BoxClient;
        }
示例#2
0
        /// <summary>
        /// Validates parameter input before processing the pipeline.
        /// </summary>
        /// <remarks>
        /// This method gets called once for each cmdlet in the pipeline when the pipeline starts executing (before the process block of any other command).
        /// </remarks>
        protected override void BeginProcessing()
        {
            if (!PoshBoxAuth.IsInitialized)
            {
                ThrowTerminatingError(
                    new ErrorRecord(
                        new Exception("No Box configuration found. Use Connect-Box to import a configuration."),
                        "9000",
                        ErrorCategory.InvalidOperation,
                        null
                        ));
            }

            if (Array.Exists(Properties, name => name == "*"))
            {
                Properties = BoxItemPropertyNameCompleter.AllPropertyNames;
            }

            fieldNames = PropertyUtility.GetPropertyNames(typeof(BoxItem), Properties);

            if (UserID == null)
            {
                WriteVerbose("Using admin client already established: " + PoshBoxAuth.BoxConfiguration.ClientId);
                client = PoshBoxAuth.BoxClient;
            }
            else
            {
                WriteVerbose("Retrieving user client for user: "******"WebLink") ? "web_link" : ItemType?.ToLower();
            Scope    = (Scope == "UserContent") ? "user_content" : "enterprise_content";
            Sort     = (Sort == "Relevance") ? "relevance" : "modified_at";
        }
        /// <summary>
        /// Validates parameter input before processing the pipeline.
        /// </summary>
        /// <remarks>
        /// This method gets called once for each cmdlet in the pipeline when the pipeline starts executing (before the process block of any other command).
        /// </remarks>
        protected override void BeginProcessing()
        {
            if (!PoshBoxAuth.IsInitialized)
            {
                ThrowTerminatingError(
                    new ErrorRecord(
                        new Exception("No Box configuration found. Use Connect-Box to import a configuration."),
                        "9000",
                        ErrorCategory.InvalidOperation,
                        null
                        ));
            }

            if (Array.Exists(Properties, name => name == "*"))
            {
                Properties = BoxCollaborationPropertyNameCompleter.AllPropertyNames;
            }

            fieldNames = PropertyUtility.GetPropertyNames(typeof(BoxCollaboration), Properties);

            if (UserID == null)
            {
                WriteVerbose("Using admin client already established: " + PoshBoxAuth.BoxConfiguration.ClientId);
                client = PoshBoxAuth.BoxClient;
            }
            else
            {
                WriteVerbose("Retrieving user client for user: " + UserID);
                client = PoshBoxAuth.NewUserClient(UserID);
            }
        }