New Ranks & Badges For The Community!
Notice something different? The ranks and associated badges have gone "Star Fleet". See what they all mean HERE
Highlighted
Absent Member.
Absent Member.
982 views

Use(getItemsRequest)cannot response the full list of library

I want to get the items' total count of library. But some library can count the full list, some library just only count one record. I have no idea what is the problem. Here is the coding.

WebReference.getItemsRequest req = new WebReference.getItemsRequest();
WebReference.getItemsResponse resp;
req.container = ((LibItem)listLibraries.SelectedItem).ID;
libname = ((LibItem)listLibraries.SelectedItem).Name;
domain = ((LibItem)listLibraries.SelectedItem).Domain;
postOffice = ((LibItem)listLibraries.SelectedItem).PostOffice;
resp = ws.getItemsRequest(req);
if (0 == resp.status.code)
{
if (null != resp.items)
{
listBoxFiles.Items.Clear();
foreach (WebReference.Document itemobj in resp.items)
{
FileItem tmpinfo = new FileItem();
tmpinfo.Name = itemobj.name;
tmpinfo.ID = itemobj.id;
tmpinfo.Version = itemobj.version;
tmpinfo.Lib_DisplayName = itemobj.library.displayName;
tmpinfo.Lib_email = itemobj.library.email;
tmpinfo.Subject = itemobj.subject;
tmpinfo.Author_DisplayName = itemobj.author.displayName;
tmpinfo.Author_email = itemobj.author.email;
tmpinfo.Created = itemobj.created;
tmpinfo.currentVersion = itemobj.currentVersion;
tmpinfo.documentNumber = itemobj.documentNumber;
tmpinfo.documentTypeName = itemobj.documentTypeName;
tmpinfo.officialVersion = itemobj.officialVersion;
tmpinfo.RetrievedDate = itemobj.modified;
listBoxFiles.Items.Add(tmpinfo);
count++;
}
LogMessage("GetLibItems success" + " count=" + count);

}

Anyone would be help me to solve this problem?

Thank you
Labels (1)
Tags (1)
0 Likes
2 Replies
Highlighted
Absent Member.
Absent Member.

There is not a good way to get a count of items in a document library.
You could try using the cursor calls.

Preston

>>> On Monday, August 06, 2012 at 4:36 AM,

jimmyng25<jimmyng25@no-mx.forums.novell.com> wrote:

> I want to get the items' total count of library. But some library can
> count the full list, some library just only count one record. I have no
> idea what is the problem. Here is the coding.
>
> WebReference.getItemsRequest req = new
> WebReference.getItemsRequest();
> WebReference.getItemsResponse resp;
> req.container =
> ((LibItem)listLibraries.SelectedItem).ID;
> libname = ((LibItem)listLibraries.SelectedItem).Name;
> domain = ((LibItem)listLibraries.SelectedItem).Domain;
> postOffice =
> ((LibItem)listLibraries.SelectedItem).PostOffice;
> resp = ws.getItemsRequest(req);
> if (0 == resp.status.code)
> {
> if (null != resp.items)
> {
> listBoxFiles.Items.Clear();
> foreach (WebReference.Document itemobj in
> resp.items)
> {
> FileItem tmpinfo = new FileItem();
> tmpinfo.Name = itemobj.name;
> tmpinfo.ID = itemobj.id;
> tmpinfo.Version = itemobj.version;
> tmpinfo.Lib_DisplayName =
> itemobj.library.displayName;
> tmpinfo.Lib_email = itemobj.library.email;
> tmpinfo.Subject = itemobj.subject;
> tmpinfo.Author_DisplayName =
> itemobj.author.displayName;
> tmpinfo.Author_email =
> itemobj.author.email;
> tmpinfo.Created = itemobj.created;
> tmpinfo.currentVersion =
> itemobj.currentVersion;
> tmpinfo.documentNumber =
> itemobj.documentNumber;
> tmpinfo.documentTypeName =
> itemobj.documentTypeName;
> tmpinfo.officialVersion =
> itemobj.officialVersion;
> tmpinfo.RetrievedDate = itemobj.modified;
> listBoxFiles.Items.Add(tmpinfo);
> count++;
> }
> LogMessage("GetLibItems success" + " count=" +
> count);
>
> }
>
> Anyone would be help me to solve this problem?
>
> Thank you

0 Likes
Highlighted
Absent Member.
Absent Member.

Preston,

Thank you for taking the time to respond. I have tried the cursor calls. But it still not work.

I have seen some of thread about cursor. I haven't use positionCursorRequest and position element of readCursorRequest.

It still return null to me. The following is my coding.

Jimmy


WebReference.createCursorRequest createCursorReq = new WebReference.createCursorRequest();
WebReference.createCursorResponse createCursorResp;

WebReference.readCursorRequest readCursorReq = new WebReference.readCursorRequest();
WebReference.readCursorResponse readCursorResp;

WebReference.destroyCursorRequest destroyCursorReq = new WebReference.destroyCursorRequest();
WebReference.destroyCursorResponse destroyCursorResp;

WebReference.getItemsRequest getItemsReq = new WebReference.getItemsRequest();
WebReference.getItemsResponse getItemsResp;

createCursorReq.container = ((LibItem)listLibraries.SelectedItem).ID;
createCursorResp = ws.createCursorRequest(createCursorReq);
if (createCursorResp.status.code == 0 || createCursorResp.cursorSpecified == true)
{
readCursorReq.container = ((LibItem)listLibraries.SelectedItem).ID;
readCursorReq.cursor = createCursorResp.cursor;
readCursorReq.forward = true;
readCursorResp = ws.readCursorRequest(readCursorReq);

if ((readCursorResp.status.code == 0)/*&& (readCursorResp.items.item != null)*/)
{
if (readCursorResp.items != null)
{
int itemListCount = readCursorResp.items.count;
long itemLength = readCursorResp.items.item.LongLength;
ws.Timeout = 10000000;

LogMessage("GetLibItems success" + " count=" + itemListCount);
LogMessage("Items Length" + " count=" + itemListCount);
btnBrowse.Enabled = true;
}
else
{
LogMessage("Read Cursor Items null.");
btnBrowse.Enabled = true;
}
}
else
{
LogMessage("Read Cursor failed.");
btnBrowse.Enabled = true;
}

if (createCursorResp.cursorSpecified == true)
{
destroyCursorReq.cursor = createCursorResp.cursor;
destroyCursorResp = ws.destroyCursorRequest(destroyCursorReq);
if (destroyCursorResp.status.code != 0)
{
LogMessage("Destroy Cursor failed.");
btnBrowse.Enabled = true;
}
}

}
else
{
LogMessage("Create Cursor failed.");
btnBrowse.Enabled = true;
}



The result was returned LogMessage("Read Cursor Items null.");
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.