Hi All,

I have used getItemsRequest to get document library items & count the it.

At the first library by a client provided. It is successful to get and count it.

When the client provide the second one. It just only count one file in the library,

but the client in GroupWise7.0.3 client can browse all the file and not only one file.

after that i have used cursor to count that, but it doesn't work.

Anyone would be help me to solve this problem?

Thank you

Jimmy


This is my coding:

Code:
				
                String libname = "";
                String domain = "";
                String postOffice = "";
                int count = 0;
                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;
                ws.Timeout = 10000000;
                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++;
                        }
                        ObjectToXml(resp, outPath + domain + "_" + postOffice + "_" + libname + ".LibraryItems.xml");
                        LogMessage("GetLibItems success" + " count=" + count);

                    }
                    btnBrowse.Enabled = true;

                }
                else
                {
                    LogMessage("GetLibItems failed");
                }
            }
            catch (Exception ex)
            {
                LogMessage("Error: " + ex.Message);
            }
This is my cursor coding:

Code:
		String libname = "";
                String domain = "";
                String postOffice = "";

                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;

                            getItemsReq.container = ((LibItem)listLibraries.SelectedItem).ID;
                            libname = ((LibItem)listLibraries.SelectedItem).Name;
                            domain = ((LibItem)listLibraries.SelectedItem).Domain;
                            postOffice = ((LibItem)listLibraries.SelectedItem).PostOffice;

                            ws.Timeout = 10000000;
                            getItemsResp = ws.getItemsRequest(getItemsReq);

                            if (0 == getItemsResp.status.code)
                            {
                                if (null != getItemsResp.items)
                                {
                                    listBoxFiles.Items.Clear();
                                    foreach (WebReference.Document itemobj in getItemsResp.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);
                                    }
                                    ObjectToXml(getItemsResp, outPath + domain + "_" + postOffice + "_" + libname + ".LibraryItems.xml");
                                    LogMessage("GetLibItems success" + " count=" + itemListCount);
                                    LogMessage("Items Length" + " count=" + itemListCount);

                                }
                                btnBrowse.Enabled = true;
                            }
                            else
                            {
                                LogMessage("GetLibItems failed");
                            }
                        }
                        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;
                }
            }
            catch (Exception ex)
            {
                LogMessage("Error: " + ex.Message);
            }