Exemple #1
0
        /// <summary>
        /// Upload a new slideshow
        /// </summary>
        /// <param name="username">Username of the slideshow owner</param>
        /// <param name="password">Password of the slideshow owner</param>
        /// <param name="slideshowTitle">Slideshow's title</param>
        /// <param name="slideshowFilePath">Path to presentation file</param>
        /// <param name="slideshowFilename">Slideshow filename</param>
        /// <param name="slideshowDescription">OPTIONAL: Description of the slideshow</param>
        /// <param name="slideshowTags">OPTIONAL: Tags of the slideshow</param>
        /// <param name="makeSrcPublic">OPTIONAL: True if you want users to be able to download the ppt file, False otherwise. Default is True</param>
        /// <param name="makeSlideshowPrivate">OPTIONAL: Make slideshow private</param>
        /// <param name="generateSecretUrl">OPTIONAL: Generate a secret URL for the slideshow. Requires makeSlideshowPrivate to be true</param>
        /// <param name="allowEmbeds">OPTIONAL: Sets if other websites should be allowed to embed the slideshow. Requires makeSlideshowPrivate to be true</param>
        /// <param name="shareWithContacts">OPTIONAL: Sets if your contacts on SlideShare can view the slideshow. Requires makeSlideshowPrivate to be true</param>
        /// <returns></returns>
        public string UploadSlideshow(string username, string password, string slideshowTitle, string slideshowFilePath, string slideshowFilename, string slideshowDescription, string slideshowTags, bool makeSrcPublic, bool makeSlideshowPrivate, bool generateSecretUrl, bool allowEmbeds, bool shareWithContacts)
        {
            var fs   = new FileStream(slideshowFilePath, FileMode.Open, FileAccess.Read);
            var data = new byte[fs.Length];

            fs.Read(data, 0, data.Length);
            fs.Close();

            var parameters = this.GetParameterBase();

            parameters.Add("username", username);
            parameters.Add("password", password);
            parameters.Add("slideshow_title", slideshowTitle);
            parameters.Add("slideshow_srcfile", new PostCommand.FileParameter(data, slideshowFilename, "application/ms-powerpoint"));
            if (!string.IsNullOrEmpty(slideshowDescription))
            {
                parameters.Add("slideshow_description", slideshowDescription);
            }

            if (!string.IsNullOrEmpty(slideshowTags))
            {
                parameters.Add("slideshow_tags", slideshowTags);
            }

            parameters.Add("make_src_public", Helper.GetYorN(makeSrcPublic));
            parameters.Add("make_slideshow_private", Helper.GetYorN(makeSlideshowPrivate));
            if (makeSlideshowPrivate)
            {
                parameters.Add("generate_secret_url", Helper.GetYorN(generateSecretUrl));
                parameters.Add("allow_embeds", Helper.GetYorN(allowEmbeds));
                parameters.Add("share_with_contacts", Helper.GetYorN(shareWithContacts));
            }

            return(PostCommand.Execute("http://www.slideshare.net/api/2/upload_slideshow", parameters));
        }
Exemple #2
0
        /// <summary>
        /// Edit Existing slideshow
        /// </summary>
        /// <param name="username">Username of the slideshow owner</param>
        /// <param name="password">Password of the slideshow owner</param>
        /// <param name="slideshowId">Slideshow ID</param>
        /// <param name="slideshowTitle">OPTIONAL: Title of the slideshow</param>
        /// <param name="slideshowDescription">OPTIONAL: Description of the slideshow</param>
        /// <param name="slideshowTags">OPTIONAL: Tags of the slideshow</param>
        /// <param name="makeSlideshowPrivate">OPTIONAL: Make slideshow private</param>
        /// <param name="generateSecretUrl">OPTIONAL: Generate a secret URL for the slideshow. Requires makeSlideshowPrivate to be true</param>
        /// <param name="allowEmbeds">OPTIONAL: Sets if other websites should be allowed to embed the slideshow. Requires makeSlideshowPrivate to be true</param>
        /// <param name="shareWithContacts">OPTIONAL: Sets if your contacts on SlideShare can view the slideshow. Requires makeSlideshowPrivate to be true</param>
        public string EditSlideshow(string username, string password, int slideshowId, string slideshowTitle, string slideshowDescription, string slideshowTags, bool makeSlideshowPrivate, bool generateSecretUrl, bool allowEmbeds, bool shareWithContacts)
        {
            var parameters = this.GetParameterBase();

            parameters.Add("username", username);
            parameters.Add("password", password);
            parameters.Add("slideshow_id", slideshowId);

            if (!string.IsNullOrEmpty(slideshowTitle))
            {
                parameters.Add("slideshow_title", slideshowTitle);
            }

            if (!string.IsNullOrEmpty(slideshowDescription))
            {
                parameters.Add("slideshow_description", slideshowDescription);
            }

            if (!string.IsNullOrEmpty(slideshowTags))
            {
                parameters.Add("slideshow_tags", slideshowTags);
            }

            parameters.Add("make_slideshow_private", Helper.GetYorN(makeSlideshowPrivate));

            if (makeSlideshowPrivate)
            {
                parameters.Add("generate_secret_url", Helper.GetYorN(generateSecretUrl));
                parameters.Add("allow_embeds", Helper.GetYorN(allowEmbeds));
                parameters.Add("share_with_contacts", Helper.GetYorN(shareWithContacts));
            }

            return(PostCommand.Execute("http://www.slideshare.net/api/2/edit_slideshow", parameters));
        }
Exemple #3
0
        /// <summary>
        /// Delete slideshow
        /// </summary>
        /// <param name="username">Username of the slideshow owner</param>
        /// <param name="password">Password of the slideshow owner</param>
        /// <param name="slideshowId">Slideshow ID</param>
        public string DeleteSlideshow(string username, string password, int slideshowId)
        {
            var parameters = this.GetParameterBase();

            parameters.Add("username", username);
            parameters.Add("password", password);
            parameters.Add("slideshow_id", slideshowId.ToString(CultureInfo.InvariantCulture));

            return(PostCommand.Execute("http://www.slideshare.net/api/2/delete_slideshow", parameters));
        }