private static Item FindRoot(BaseFactory factory, BaseSettings settings)
        {
            var database = factory.GetDatabase(settings.GetSetting("Meetup.DefaultRepo", defaultValue: "web"), assert: true);

            using (new SecurityDisabler())
            {
                var item = database.GetItem(ItemIDs.MeetupContentRootId);

                return(item ?? throw new RequiredObjectIsNullException($"Root item {ItemIDs.MeetupContentRootId} was not found in {database.Name}"));
            }
        }
示例#2
0
        private static string GetItemNotFoundUrl(BaseSettings settings)
        {
            string url = settings.GetSetting("ItemNotFoundUrl", null);

            if (string.IsNullOrEmpty(url))
            {
                throw new EnterspeedSitecoreException(
                          "Unable to retrieve Enterspeed API Key from the Sitecore Setting \"ItemNotFoundUrl\".");
            }

            return(url);
        }
示例#3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AzureStorageUpload"/> class.
        /// </summary>
        /// <param name="settings">
        /// The settings.
        /// </param>
        public AzureStorageUpload(BaseSettings settings)
        {
            var    containerName    = settings.GetSetting("Azure.ContainerName");
            string connectionString = settings.GetSetting("Azure.StorageConnectionString");

            // Use ConfigurationManager to retrieve the connection string
            CloudStorageAccount storageAccount = CloudStorageAccount.Parse(connectionString);

            // Create a CloudBlobClient object using the storage account to retrieve objects that represent containers and blobs stored within the Blob Storage Service
            CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();

            // Retrieve a reference to a container.
            this.container = blobClient.GetContainerReference(containerName);

            // Create the container if it doesn't already exist.
            this.container.CreateIfNotExists();

            // By default, the new container is private and you must specify your storage access key to download blobs from this container. If you want to make the files within the container available to everyone, you can set the container to be public
            this.container.SetPermissions(
                new BlobContainerPermissions {
                PublicAccess = BlobContainerPublicAccessType.Blob
            });
        }