2

While bulk uploading images in Media Manager using SDL media manager, we are able to create Asset and Program but not able to create Distribution even after setting data.DistributionCreation=DistributionCreationOptions.OneDistributionPerItem.

Please review below code that i am using:

UploadInfoData data = new UploadInfoData();
                data.DistributionCreation=DistributionCreationOptions.OneDistributionPerItem;
                data.IsIncludedInGalleries = true;
                data.MakeAvailableForDownload = true;
                data.MakeAvailableForWebPublishing = true;
                data.IsRoyaltyFree = true;
                data.ProgramCreation = ProgramCreationOptions.OneProgramPerItem;
                mediaManagerService = new MediaManager2011Client("FederationEndpointHttps");
                string uploadUrl = mediaManagerService.GetUploadUrl(folderId, assetTypeId, tags, keywords, data);

                var response=new WebClient().UploadFile(uploadUrl, fullPathToFileToUpload);
5
  • Does the user you're connecting with have the "Distribution Management" user privilege? Jan 19, 2017 at 9:10
  • I have a doubt when we create an asset manually and opt for Distribution creation in Media Manager they ask for Image Outlet to select but in service they are not asking for Outlet Id so which outlet will be selected on creation of image. Jan 19, 2017 at 9:25
  • I'm not sure... Have you tested it? You may need to create the program(s) and distribution yourself via the API Jan 19, 2017 at 10:20
  • Program got created but distribution is not while testing Jan 19, 2017 at 10:44
  • @DavidForster Do you have any reference from creating a new distribution. Jan 19, 2017 at 12:44

1 Answer 1

1

Please make sure you are setting the correct Outlet Id. If you know the outlet's name, here is a method to return the equivalent id.

private static long GetOutletId(IMediaManager2011 mediaManagerClient)
{
    // This returns the list of outlets
    IEnumerable<ItemData> outletList = mediaManagerClient.GetList(ItemTypes.All, 0, 
            ItemTypes.Outlet, GetListResultLevel.Minimal) as IEnumerable<ItemData>;
    foreach (var outlet in outletList)
    {
        if (String.Equals(outlet.Name, Options.MediaManagerOutlet))
        {
            log.Info("Media Manager outlet found");
            return outlet.Id;
        }
    }
    return -1;
}

Please check the code samples I have provided here: http://philipmedcraft.blogspot.com.br/2017/03/uploading-images-from-sdl-web-tridion.html

2
  • Thanks Phil for your answer. But even you are doing the same thing creating distribution after creating Asset and Program id. Mar 31, 2017 at 4:56
  • Yes, indeed I am. You just have to I'm afraid. There is no suitable explanation for this (I have searched as well). Apr 3, 2017 at 18:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.