This project is read-only.

Some functions seem not to work!

Jan 19, 2009 at 10:43 PM
Edited Jan 21, 2009 at 3:01 AM
I have successfully been able to add documents programmatically in C# and commend you and your team on all the work being done.  We are evaluating Scribd as it seems to provide a plethora of great features.  However (you knew that was coming!), I have been having some difficulty with retrieving some of the information correctly.  Either I am not doing things correctly or there is a problem in the dll.  I wrote a simple Windows app that allows the following:  1) Login,  2) Display all documents from the user (me) and 3) allows uploading of documents.  Shown below are the code snippets being used:

This allows the retrieval of the documents, please note the comments in Bold.  The three issues are that:

1) the ReloadDocuments does not change anything.  If I upload a document from either my program or at the Scribd site, My Documents, I don't receive information about the uploaded file for almost 1/2 hour.  However, on the site it shows up almost immediately.

2) The documentType always returns null even though I always upload the documentType as "doc"

3) The accessType always returns PUBLIC even if I have made it private.

I have looked over most of the documentation and the forum but have not found any solutions to my problems.  I hope you can help!

I have checked the search.cs code for your dll and noticed that most of the items I mention above are not available because they are not retrieved in your code.  In the Result InnerFind function, in the response area I saw your retrieval from the XmlNode of the DocumentId, Title, Description, ThumbnailUrl, AccessKey, and tags, but not the conversionStatus, RevisionID, AccessType and DocumentType.  If my quick research is correct, is there a time frame when these items can be added?

Once again, many thanks for your hard work.  I truly appreciate the effort.

Thanks Bob

==============================================

 

private void scribdSearch_Click(object sender, EventArgs e)

 

{

// This doesn't seem to have any effect. It still takes an ordinate amount of time to get an update.

Scribd.Net.

Service.User.ReloadDocuments();

 

Scribd.Net.

Search.Criteria mySearchCriteria = new Scribd.Net.Search.Criteria();

 

// This is for testing only

mySearchCriteria.Query =

"document";

 

// mySearchCriteria.Scope = Scribd.Net.SearchScope.All;

mySearchCriteria.Scope = Scribd.Net.

SearchScope.User;

 

mySearchCriteria.MaxResults = 100;

mySearchCriteria.StartIndex = 1;

 

 

// Call the service.

 

Scribd.Net.

Search.Result mySearchResult = Scribd.Net.Search.Find(mySearchCriteria);

 

doclist.Items.Clear();

selectedItem.Text =

"There are " + mySearchResult.Documents.Count.ToString() + " documents found";

 

 

string[] lvData = new String[8];

 

fileListView.Items.Clear();

 

int currentIndex = 1;

 

 

 

foreach (Scribd.Net.Document currentDocument in mySearchResult.Documents)

 

{

doclist.Items.Add(currentDocument.Title.ToString());

lvData[0] = currentIndex.ToString();

lvData[1] = currentDocument.Title.ToString();

lvData[2] = currentDocument.DocumentId.ToString();

lvData[3] = currentDocument.Description.ToString();

// This always returns null

 

if (currentDocument.DocumentType != null)

 

lvData[4] = currentDocument.DocumentType.ToString();

// This was null

 

 

else

 

lvData[4] =

"";

 

lvData[5] = currentDocument.RevisionId.ToString();

// This always returns PUBLIC regardless of what it actually is!

lvData[6] = currentDocument.AccessType.ToString();

lvData[7] = currentDocument.ThumbnailUrl.AbsoluteUri.ToString();

 

ListViewItem lvItem = new ListViewItem(lvData, 0);

 

 

fileListView.Items.Add(lvItem);

currentIndex++;

}

doclist.SelectedItem = 0;

}

 

// This method is called on successful login.

 

 

public void Document_Uploaded(object sender, DocumentEventArgs e)

 

{

updateStatus(e.Document.DocumentId.ToString());

}

 

 

private void upload_Click(object sender, EventArgs e)

 

{

 

string fileName = "";

 

 

OpenFileDialog filedlg = new OpenFileDialog();

 

 

 

if (filedlg.ShowDialog() == DialogResult.OK)

 

{

fileName = filedlg.FileName;

}

 

else

 

{

 

return;

 

}

 

// Set up upload notification

 

Scribd.Net.

Document.Uploaded += new EventHandler<DocumentEventArgs>(Document_Uploaded);

 

// This doesn't seem to work at all.

// Scribd.Net.Document settings = Scribd.Net.Document.Upload(fileName, AccessTypes.Public, 1, "doc");

// This works but can never get the documentType on reading??

Scribd.Net.

Document settings = Scribd.Net.Document.Upload(fileName, "doc");

 

// This is for testing - Must update these things then do a save.

settings.DocumentType =

"doc";

 

settings.Description =

"This is a description for the new uploaded doc file.";

 

settings.Title =

"This is the new title!";

 

settings.Save();

 

}

 

public void updateStatus(string message)

 

{

scribdStatus_Text.Text = message;

}

Coordinator
Feb 9, 2009 at 5:28 PM
Please take a look at the demo app in the source control for correct (or rather, intended) use of the library.

- Paul
Feb 10, 2009 at 9:59 PM
Dear Paul:

Thanks for your reply.  I looked over your sample and although a little different than mine (I used your description in the documentation), I am still not able to retrieve some of the document information. Shown below is the code to do a search. The three fields in question are:

AccessType - This is always set to Public (regardless of what the true value, shown online in Scribd MyDocuments (for my documents).
DocumentType - This is always null
ConversionStatus - This is always None_Specified

I provide this source code snippet which shows the way I do things and below this is the Watch in Visual C# showing the results for one of my documents.  Below that is the output using Scribd on the web in MyDocs. 
If I am doing something incorrectly, please let me know.  Also, is there any way to have the search criteria query to return all documents? If I put in "" it will return all documents (like Word and PowerPoint) which contain null, but no text files will be returned.  If I search for a space character or string, nothing is returned.  Any help on this would also be greatly appreciated.  Finally, do you have the demoApp you provide in your source repository available as a Windows executable? 

Thanking you in advance for any help you can provide.

================ Source ======================

        private void scribdSearch_Click(object sender, EventArgs e)
        {
            if (loginStatus.Text == "Not Logged In")
            {
                MessageBox.Show("You must log in before using this function.", "Not Logged In", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            selectedItem.Text = "Searching for documents...";
            this.Refresh();
            this.Invalidate();


            Scribd.Net.Search.Criteria mySearchCriteria = new Scribd.Net.Search.Criteria();

            mySearchCriteria.Query = searchItems.Text;
            mySearchCriteria.Scope = Scribd.Net.SearchScope.User;
            mySearchCriteria.MaxResults = 100;
            mySearchCriteria.StartIndex = 1;
            Scribd.Net.Search.Result mySearchResult = null;           
            // Call the service.
            try
            {
                mySearchResult = Scribd.Net.Search.Find(mySearchCriteria);
            }
            catch (Exception ex)
            {
                string statusString = null;

                statusString = "Catch Exception - Unsuccessful search.\n";
                statusString += ex.Message.ToString();
                MessageBox.Show(statusString, "Search Failure!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            doclist.Items.Clear();
            selectedItem.Text = "There are " +  mySearchResult.Documents.Count.ToString() + " documents found";

            string[] lvData = new String[8];
            fileListView.Items.Clear();
            fileListView.CheckBoxes = true;
            int currentIndex = 1;
           
            foreach (Scribd.Net.Document currentDocument in mySearchResult.Documents)
            {

                doclist.Items.Add(currentDocument.Title.ToString());

                lvData[0] = currentIndex.ToString();
                lvData[1] = currentDocument.Title.ToString();
                lvData[2] = currentDocument.DocumentId.ToString();
                lvData[3] = currentDocument.Description.ToString();

// This always returns null
                if (currentDocument.DocumentType != null)
                    lvData[4] = currentDocument.DocumentType.ToString(); // This was null
                else
                    lvData[4] = "";

                lvData[5] = currentDocument.RevisionId.ToString();

// This always returns PUBLIC regardless of what it actually is!

                lvData[6] = currentDocument.AccessType.ToString();
                ListViewItem lvItem = new ListViewItem(lvData, 0);

                if(currentDocument.ConversionStatus == ConversionStatusTypes.Displayable)
                    lvData[7] = "Displayable";

                if(currentDocument.ConversionStatus == ConversionStatusTypes.Done)
                    lvData[7] = "Done";

                if(currentDocument.ConversionStatus == ConversionStatusTypes.Error)
                    lvData[7] = "Error";
         
                if(currentDocument.ConversionStatus == ConversionStatusTypes.None_Specified)
                    lvData[7] = "None Specified";
                   
                if(currentDocument.ConversionStatus == ConversionStatusTypes.Processing)
                    lvData[7] = "Processing";
                   
                if(currentDocument.ConversionStatus == ConversionStatusTypes.Published)
                    lvData[7] = "Published";

                fileListView.Items.Add(lvItem);

                currentIndex++;

              }
        }
================ End Source ======================

================ Visual C# Watch Window ======================

Here is section of the watch in Visual C# 2005 using the API and shown below is the same document using Scribd.

        <Title>k__BackingField                        "compaqlaptop1.pdf"                              string
        <WhenPublished>k__BackingField        {1/1/0001 12:00:00 AM}                      System.DateTime
        AccessKey                                            "...................................."                       string
        AccessType                                           Public                                                    Scribd.Net.AccessTypes
        Author                                                   null                                                        string
        ConversionStatus                                   None_Specified                                     Scribd.Net.ConversionStatusTypes
        Description                                            "This is the compaq reference manual"    string
        DocumentId                                           10972092                                             int
        DocumentType                                       null                                                       string
        Edition                                                    null                                                      string
        LargeImageData                                     null                                                       byte[]
        LargeImageURL                                    null                                                       System.Uri
        License                                                  None_Specified                                   Scribd.Net.CCLicenseTypes
        LinkBackURL                                       null                                                       System.Uri
        m_largeImageData                                null                                                        byte[]
        m_thumbnailData                                 {Dimensions:[1880]}                              byte[]
        m_thumbnailSize                                  {Width = 0 Height = 0}                          System.Drawing.Size

================ End Visual C# Watch Window ======================

================ Scribd on the Web - MyDocs ======================

This is from MyDocuments on Scribd:

compaqlaptop1.pdf

Thumbnail

Title <input type="text" value="compaqlaptop1.pdf" size="50" name="word_document[10972092][title]" id="word_document_10972092_title" class="text_field" />
Description <textarea rows="5" name="word_document[10972092][description]" id="word_document_10972092_description" cols="40" class="text_area_field">This is the compaq reference manual</textarea>
Type
<select width="150" name="word_document[10972092][top_category_id]" id="word_document_10972092_top_category_id" class="top"> <option value="0">choose a type / category</option> <option value="34">Academic Work</option> <option value="69">Brochures & Catalogs</option> <option value="115">Business & Legal</option> <option value="135">Cooking & Menus</option> <option value="47">Creative Writing</option> <option value="93">How-To Guides & DIY</option> <option value="86">Illustrations</option> <option value="30">Manuals</option> <option value="79">Periodicals & Reports</option> <option value="182">Presentations & Slideshows</option> <option value="176">Puzzles & Games</option> <option value="54">Research</option> <option value="11">Resumes & CVs</option> <option value="24">Sheet Music & Tablature</option> <option value="2">Spreadsheets</option> <option value="146">eBooks</option> </select>
Category
<select width="150" name="word_document[10972092][child_category_id]" id="child_34" disabled="disabled" class="child_34"> <option value="35">--Essays</option> <option value="36">--Homework</option> <option value="37">--Theses</option> <option value="38">--Reports</option> <option value="39">--Presentations</option> <option value="40">--Notes</option> <option value="41">--Study Guides</option> <option value="42">--Course Information</option> <option value="43">--Exams & Quizzes</option> <option value="44">--Draft Research</option> <option value="45">--Published Research</option> <option value="46">--Other</option> </select>
<select width="150" name="word_document[10972092][child_category_id]" id="child_69" disabled="disabled" class="child_69"> <option value="70">--Business</option> <option value="71">--Travel</option> <option value="72">--Promotional</option> <option value="73">--Retail</option> <option value="74">--Informational</option> <option value="75">--Marketing</option> <option value="76">--Religion & Spirituality</option> <option value="77">--Education</option> <option value="78">--Other</option> </select>
<select width="150" name="word_document[10972092][child_category_id]" id="child_115" disabled="disabled" class="child_115"> <option value="116">--Wills and Trusts</option> <option value="117">--Contracts</option> <option value="118">--Forms</option> <option value="119">--Court Filings</option> <option value="120">--Patents</option> <option value="121">--Incorporation</option> <option value="122">--Government</option> <option value="123">--Real Estate</option> <option value="124">--Taxes</option> <option value="125">--Finance & Investing</option> <option value="126">--Accounting</option> <option value="127">--Business Planning</option> <option value="128">--Employment</option> <option value="129">--Marketing</option> <option value="130">--Press Releases</option> <option value="131">--Venture Capital</option> <option value="132">--Research</option> <option value="133">--Mortgage</option> <option value="134">--Other</option> </select>
<select width="150" name="word_document[10972092][child_category_id]" id="child_135" disabled="disabled" class="child_135"> <option value="136">--Desserts & Pastries</option> <option value="137">--Vegetarian & Vegan</option> <option value="138">--Grilling</option> <option value="139">--Diet & Health Food</option> <option value="140">--Appetizers</option> <option value="141">--Asian</option> <option value="142">--Indian</option> <option value="143">--Italian</option> <option value="144">--Menus</option> <option value="145">--Other</option> </select>
<select width="150" name="word_document[10972092][child_category_id]" id="child_47" disabled="disabled" class="child_47"> <option value="48">--Short Stories</option> <option value="49">--Screenplays & Plays</option> <option value="50">--Poetry</option> <option value="51">--Fan Fiction</option> <option value="52">--Humor</option> <option value="53">--Other</option> </select>
<select width="150" name="word_document[10972092][child_category_id]" id="child_93" disabled="disabled" class="child_93"> <option value="94">--Home & Garden</option> <option value="95">--Health & Medicine</option> <option value="96">--Crafts & Hobbies</option> <option value="97">--Parenting</option> <option value="98">--Pets</option> <option value="99">--Travel</option> <option value="100">--Internet & Technology</option> <option value="101">--Legal</option> <option value="102">--Business</option> <option value="103">--Automotive</option> <option value="104">--Fashion & Style</option> <option value="105">--Weddings & Parties</option> <option value="106">--Career & Professional</option> <option value="107">--User Manuals</option> <option value="108">--Dating</option> <option value="109">--Sports</option> <option value="110">--Science & Engineering</option> <option value="111">--Technology</option> <option value="112">--Education</option> <option value="113">--Religion & Spirituality</option> <option value="114">--Other</option> </select>
<select width="150" name="word_document[10972092][child_category_id]" id="child_86" disabled="disabled" class="child_86"> <option value="87">--Maps</option> <option value="88">--Charts</option> <option value="89">--Diagrams</option> <option value="90">--Comics</option> <option value="91">--Art</option> <option value="92">--Other</option> </select>
<select width="150" name="word_document[10972092][child_category_id]" id="child_30" disabled="disabled" class="child_30"> <option value="31">--Product Manuals</option> <option value="32">--How-To & DIY</option> <option value="33">--Other</option> </select>
<select width="150" name="word_document[10972092][child_category_id]" id="child_79" disabled="disabled" class="child_79"> <option value="80">--Magazines</option> <option value="81">--Newspapers</option> <option value="82">--Newsletters</option> <option value="83">--Reports</option> <option value="84">--Articles</option> <option value="85">--Other</option> </select>
<select width="150" name="word_document[10972092][child_category_id]" id="child_182" disabled="disabled" class="child_182"> <option value="183">--Business</option> <option value="184">--Internet & Technology</option> <option value="185">--Science & Engineering</option> <option value="186">--Politics & Government</option> <option value="187">--Sports</option> <option value="188">--Travel</option> <option value="189">--Legal</option> <option value="190">--Children & Teens</option> <option value="191">--Design</option> <option value="192">--Humor</option> <option value="193">--Health & Medicine</option> <option value="194">--How-To & DIY</option> <option value="195">--Real Estate</option> <option value="196">--Education</option> <option value="197">--History</option> <option value="198">--Religion & Spirituality</option> <option value="199">--Other</option> </select>
<select width="150" name="word_document[10972092][child_category_id]" id="child_176" disabled="disabled" class="child_176"> <option value="177">--Puzzles</option> <option value="178">--Board Games</option> <option value="179">--Card Games</option> <option value="180">--Electronic Games</option> <option value="181">--Other</option> </select>
<select width="150" name="word_document[10972092][child_category_id]" id="child_54" disabled="disabled" class="child_54"> <option value="55">--Engineering</option> <option value="56">--Physics</option> <option value="57">--Mathematics</option> <option value="58">--Economics</option> <option value="59">--Internet & Technology</option> <option value="60">--Language</option> <option value="61">--Literature</option> <option value="62">--Business</option> <option value="63">--Architecture</option> <option value="64">--Health & Medicine</option> <option value="65">--Biology & Chemistry</option> <option value="66">--Humanities</option> <option value="67">--Legal</option> <option value="68">--Other</option> </select>
<select width="150" name="word_document[10972092][child_category_id]" id="child_11" disabled="disabled" class="child_11"> <option value="12">--Templates & Examples</option> <option value="13">--Job Listings</option> <option value="14">--Engineering & Technical</option> <option value="15">--Business</option> <option value="16">--Administrative</option> <option value="17">--Culinary</option> <option value="18">--Education & Teaching</option> <option value="19">--New College Grad & Entry Level</option> <option value="20">--Executives</option> <option value="21">--Retail</option> <option value="22">--Writers & Copy Editors</option> <option value="23">--Other</option> </select>
<select width="150" name="word_document[10972092][child_category_id]" id="child_24" disabled="disabled" class="child_24"> <option value="25">--Classical</option> <option value="26">--Jazz</option> <option value="27">--Pop</option> <option value="28">--Instructional</option> <option value="29">--Other</option> </select>
<select width="150" name="word_document[10972092][child_category_id]" id="child_2" disabled="disabled" class="child_2"> <option value="3">--Business</option> <option value="4">--Politics & Government</option> <option value="5">--Education</option> <option value="6">--Real Estate</option> <option value="7">--Legal</option> <option value="8">--Forms & Templates</option> <option value="9">--Statistics</option> <option value="10">--Other</option> </select>
<select width="150" name="word_document[10972092][child_category_id]" id="child_146" disabled="disabled" class="child_146"> <option value="147">--Fiction & Literature</option> <option value="148">--Non-fiction</option> <option value="149">--Thriller</option> <option value="150">--Mystery</option> <option value="151">--Romance</option> <option value="152">--Textbooks</option> <option value="153">--Children's Books</option> <option value="154">--Biographies & Memoirs</option> <option value="155">--Business</option> <option value="156">--Language</option> <option value="157">--Health & Medicine</option> <option value="158">--History</option> <option value="159">--Home & Garden</option> <option value="160">--Legal</option> <option value="161">--Travel</option> <option value="162">--Sports</option> <option value="163">--Science Fiction & Fantasy</option> <option value="164">--Comics & Graphic Novels</option> <option value="165">--Science & Engineering</option> <option value="166">--Internet & Technology</option> <option value="167">--Politics & Government</option> <option value="168">--Humor</option> <option value="169">--Drafts</option> <option value="170">--Religion & Spirituality</option> <option value="171">--Education</option> <option value="172">--How-To & DIY</option> <option value="173">--Fan Fiction</option> <option value="174">--Philosophy</option> <option value="175">--Other</option> </select>
<select disabled="true" style="width: 200px;" class="blank" id="blank_select_10972092"> <option value="0">Choose a type first</option> </select>
Tags <small>Enter tags, separated by commas</small>

<input type="text" value="Laptop, Manual, 5G, compaq, fiveg" style="top: 0pt; left: 0pt; width: 300px;" size="30" name="word_document[10972092][word_tags_csv]" id="word_tags_10972092" class="tag_field text_input yui-ac-input" autocomplete="off" />
Revisions Upload a new revision of this document

Permissions and Licenses Small_blue_arrow


Privacy

<input type="radio" value="0" name="word_document[10972092][privacy_settings_string_number]" id="word_document_10972092_privacy_settings_string_number_0" class="button" /> Public - anyone can see this document

<input type="radio" value="1" name="word_document[10972092][privacy_settings_string_number]" id="word_document_10972092_privacy_settings_string_number_1" class="button" checked="checked" /> Private - keep this document secret

<small>Private documents are accessible only at a secret URL you can choose to share with your friends.</small>
License
<input type="radio" value="5" name="word_document[10972092][copyright_id_string]" id="word_document_10972092_copyright_id_string_5" class="button" /> Public Domain Public_domain
<input type="radio" value="2" name="word_document[10972092][copyright_id_string]" id="word_document_10972092_copyright_id_string_2" class="button" /> Attribution Attribution
<input type="radio" value="3" name="word_document[10972092][copyright_id_string]" id="word_document_10972092_copyright_id_string_3" class="button" checked="checked" /> Attribution Non-commercial Attribution_noncommercial
<input type="radio" value="4" name="word_document[10972092][copyright_id_string]" id="word_document_10972092_copyright_id_string_4" class="button" /> Attribution Non-commercial No-derivs Attribution_noncommercial_noderivatives
<input type="radio" value="6" name="word_document[10972092][copyright_id_string]" id="word_document_10972092_copyright_id_string_6" class="button" /> Attribution Non-commercial Share Alike Attribution_noncommercial_share
<input type="radio" value="7" name="word_document[10972092][copyright_id_string]" id="word_document_10972092_copyright_id_string_7" class="button" /> Attribution Share Alike Attribution_share
<input type="radio" value="8" name="word_document[10972092][copyright_id_string]" id="word_document_10972092_copyright_id_string_8" class="button" /> Attribution No Derivatives Attribution_noderivatives
<input type="radio" value="1" name="word_document[10972092][copyright_id_string]" id="word_document_10972092_copyright_id_string_1" class="button" /> Traditional Copyright: All rights reserved Traditional_copyright

================ End Scribd on the Web - MyDocs ======================

Coordinator
Feb 11, 2009 at 3:24 AM

RDCS:

Because you are retreiving these items by using the Search functionality, certain properties are not available.  (Please see http://www.scribd.com/publisher/api?method_name=docs.search for more information.)

The following are the only properties currently available from Scribd.com for search: Document ID, Secret Password, Access Key, Title, Description, Tags, License, Thumbnail and Page Count.  As far as the search criteria goes, please refer to http://www.scribd.com/publisher/search_help for more information on what is acceptable.  If you need the additional fields, you'll have to pull them down individually, I'm afraid.

This library is a wrapper for the Scribd.com platform API.  It can only return information that is provided by the API.  I am not affiliated with Scribd, but if there are elements you wish to see added to the API, I can certainly request them and see if we can get it added.

As far as the demo application, you can look on the Releases tab in a little while; I'll upload it compiled for you.

- Paul