Skip to main content link. Accesskey S
  • Log In
  • Help
  • IBM Logo
  • Lotus Quickr wiki
  • All Wikis
  • All Forums
  • Home
  • Product Documentation
  • Community Articles
  • Learning Center
  • IBM Redbooks
Community Articles Product Documentation Learning Center IBM Redbooks This category Lotus Quickr 8.5 for WebSphere Portal Documentation Lotus Quickr 8.5.1 for Domino Documentation Lotus Quickr Connectors 8.5 Documentation Custom Search Scope...
Search
Community Articles > Best practices: Quickr Content Integrator > A Simple C# Example of Accessing Quickr Documents
  • New Article
  • Share Show Menu▼
  • Subscribe Show Menu▼

About the Original Author

Gregory Melahn
Contribution Summary:
  • Articles authored: 12
  • Articles edited: 47
  • Comments Posted: 12

Recent articles by this author

Using Lotus Quickr for Portal with a Cloud Deployment of Alfresco

Quickr for Portal can use Alfresco as an alternative ECM. An Amazon cloud image that includes this integration has been deployed. This page describes how to use this image.

Document Metadata for Lotus Quickr (Portal Services)

These are the metadata that can be attached to documents in Lotus Quickr (Portal Services), out-of-the-box. More properties can be defined in addition to these properties. Standard Metadata

Simple Example of Using a REST Service to Post a Blog Entry

This is a simple programming example of how to use the REST service introduced in Quickr 8.1.1 for working with blog content. This example posts a new blog entry. The prerequisite for using this example is Quickr 8.1.1 Portal Services and a jdk. Usage is BlogPostEntry QuickrUrl QuickrBlogId ...

Virus Scanning using Trend Micro ScanMail

Introduction Lotus Quickr can be used to collaborate on documents across an enterprise. Since Quickr makes it easy to share documents, it is especially important to assure that documents are free

Virus Scanning using Trend Micro ScanMail

Introduction Lotus Quickr can be used to collaborate on documents across an enterprise. Since Quickr makes it easy to share documents, it is especially important to assure that documents are free

Community articleA Simple C# Example of Accessing Quickr Documents

Added by Gregory Melahn | Edited by IBM contributor Gregory Melahn on October 2, 2008 | Version 19
expanded Abstract
collapsed Abstract
No abstract provided.
Tags: C#, Content Services, Feed, Document Services, Atom, Microsoft

The Microsoft .NET framework includes classes to access Atom Feeds. Since Lotus Quickr is based on Atom feeds, it is possible to build .NET applications that use documents in Quickr.

This wiki article describes a simple application that accesses Quickr documents using an Atom feed. The example application was built using Microsoft Visual C# 2008 Express Edition.

First, it's important to understand the relationship between Atom Feeds and the documents you use in Quickr. Where you see a list of documents in Quickr, and you see the feed icon, that means the list of documents is available as a feed.

For example, when I look at the documents in a folder in Quickr, the list of documents is accessible as a feed. 

Clicking on the Feed link shows the contents of the folder as a feed as in this example...

Now, suppose you wanted to build an application that uses those same documents, in C#. This can all be done in a few dozen lines of code.

The first thing you would do is identify the .NET framework classes you need to retrieve and parse the content, and include these in a using statement, along with any other classes you wanted to use (for example for I/O). In this example, we will include...

using System;
using System.Xml;
using System.ServiceModel.Syndication;
using System.Collections.ObjectModel;
using System.IO;


Then, you would need some way for the user to provide the url of the feed, as well as the credentials to use to access the content. In this simple example, we will just use the Windows console for that. In real life of course you would get this information from a form or other, more friendly, user interface. But the console is enough for illustration purposes...

Console.WriteLine("Enter Quickr Feed URL");
String url = Console.ReadLine();
System.Net.NetworkCredential nc = new System.Net.NetworkCredential();
Console.WriteLine("Enter Userid");
nc.UserName = Console.ReadLine();
Console.WriteLine("Enter Password");
nc.Password = Console.ReadLine();


With the URL of the feed and the credentials in hand, it is possible now to request the feed from Quickr, as a standard HTTP request...

System.Net.WebRequest wrq = System.Net.WebRequest.Create(url);
System.Net.CredentialCache cc = new System.Net.CredentialCache();
System.Net.WebResponse wrs = null;
System.IO.Stream ios = null;
Uri uri = new Uri(url);
cc.Add(uri, "basic", nc);
wrq.Credentials = cc;
wrs = wrq.GetResponse();
ios = wrs.GetResponseStream();


Now, it it necessary to parse the response so it is understandable as an Atom feed, and elements from the feed can be used by the application.

XmlReader xr = XmlReader.Create(ios);
System.ServiceModel.Syndication.SyndicationFeed sf = SyndicationFeed.Load(xr);

Then we can start to use the information in the feed. As in this example, where we print some information to the console.

String baseUri = sf.BaseUri.ToString();
Console.WriteLine("Feed Summary...");
Console.WriteLine("\tBase URI: " + baseUri);
Console.WriteLine("\tGenerator: " + sf.Generator);
Console.WriteLine("\tUpdated on: " + sf.LastUpdatedTime);


The documents in this feed are accessible as feed items. In the example, we enumerate those items and print more information to the console...

Console.WriteLine("Items:...");
int i = 1;
foreach (SyndicationItem item in sf.Items)
{
     String category = item.Categories[0].Name;
     Console.Wr iteL ine("\tItems (" + i++ + ")");
     String mainAuthorName = (item.Authors[0]).Name;
     String mainAuthorEmail = (item.Authors[0]).Email;
     Console.WriteLine("\t\tTitle: " + (item.Title.Text));
     Console.WriteLine("\t\tDescription: " + item.Summary.Text);
     Console.WriteLine("\t\tCategory: " + item.Categories[0].Name);
     Console.WriteLine("\t\tAuthor Name: " + mainAuthorName);
     Console.WriteLine("\t\tAuthor email: " + mainAuthorEmail);  
    Console.WriteLine("\t\tCreated on: " + item.PublishDate);
    Console.WriteLine("\t\tUpdated on: " + item.LastUpdatedTime);
    Console.WriteLine("\t\tDownload URL: " + baseUri + ((UrlSyndicationContent)item.Content).Url);
}


Running that program shows the same documents you saw before in the browser.


The URL's shown in the console are ones you can use to download the docu ment from Quickr. For example, if you pasted the URL of one of these documents into a web browser, it would download the document.

Here is the complete program ...






expanded Attachments (0)
collapsed Attachments (0)
expanded Versions (36)
collapsed Versions (36)
Version Comparison     
VersionDateChanged by              Summary of changes
39Apr 22, 2009 10:10:41 PMDana Liburdi  IBM contributor
38Nov 19, 2009 11:17:49 AMKristopher T Stoddard  IBM contributor
37Jul 19, 2009 8:51:40 PMKristopher T Stoddard  IBM contributor
36Jan 19, 2009 10:48:55 AMDana Liburdi  IBM contributor
35Oct 3, 2008 4:30:12 PMGregory Melahn  IBM contributor
34Oct 3, 2008 4:28:33 PMGregory Melahn  IBM contributor
33Oct 3, 2008 4:27:50 PMGregory Melahn  IBM contributor
32Oct 3, 2008 4:25:51 PMGregory Melahn  IBM contributor
31Oct 3, 2008 3:21:27 PMGregory Melahn  IBM contributor
30Oct 3, 2008 3:20:09 PMGregory Melahn  IBM contributor
29Oct 3, 2008 3:14:39 PMGregory Melahn  IBM contributor
28Oct 3, 2008 3:13:45 PMGregory Melahn  IBM contributor
27Oct 2, 2008 11:38:00 AMGregory Melahn  IBM contributor
26Oct 2, 2008 11:37:05 AMGregory Melahn  IBM contributor
25Oct 2, 2008 11:35:16 AMGregory Melahn  IBM contributor
24Oct 2, 2008 11:34:05 AMGregory Melahn  IBM contributor
23Oct 2, 2008 11:33:01 AMGregory Melahn  IBM contributor
22Oct 2, 2008 11:28:53 AMGregory Melahn  IBM contributor
21Oct 2, 2008 11:23:32 AMGregory Melahn  IBM contributor
20Oct 2, 2008 11:22:23 AMGregory Melahn  IBM contributor
This version (19)Oct 2, 2008 10:57:46 AMGregory Melahn  IBM contributor
18Oct 2, 2008 10:56:29 AMGregory Melahn  IBM contributor
17Oct 2, 2008 10:49:38 AMGregory Melahn  IBM contributor
16Oct 2, 2008 10:48:55 AMGregory Melahn  IBM contributor
15Oct 2, 2008 10:47:34 AMGregory Melahn  IBM contributor
14Oct 2, 2008 10:47:06 AMGregory Melahn  IBM contributor
13Oct 2, 2008 10:46:19 AMGregory Melahn  IBM contributor
12Oct 2, 2008 9:52:53 AMGregory Melahn  IBM contributor
11Oct 2, 2008 9:52:19 AMGregory Melahn  IBM contributor
10Oct 2, 2008 9:51:38 AMGregory Melahn  IBM contributor
9Oct 2, 2008 9:50:43 AMGregory Melahn  IBM contributor
8Oct 2, 2008 9:36:48 AMGregory Melahn  IBM contributor
7Oct 2, 2008 9:25:07 AMGregory Melahn  IBM contributor
6Oct 1, 2008 6:20:01 PMGregory Melahn  IBM contributor
5Oct 1, 2008 6:13:38 PMGregory Melahn  IBM contributor
3Oct 1, 2008 2:45:43 PMGregory Melahn  IBM contributor
Copy and paste this wiki markup to link to this article from another article in this wiki.
Go ElsewhereStay ConnectedHelpAbout
  • IBM Collaboration Solutions wikis
  • IBM developerWorks
  • IBM Software support
  • Twitter LinkIBMSocialBizUX on Twitter
  • FacebookIBMSocialBizUX on Facebook
  • ForumsLotus product forums
  • BlogsIBM Social Business UX Blog
  • Community LinkIBM Collaboration Solutions
  • Wiki Help
  • Forgot user name/password
  • Wiki design feedback
  • Content feedback
  • About the wiki
  • About IBM
  • Privacy
  • Accessibility
  • IBM Terms of use
  • Wiki terms of use