예제 #1
0
        /// <summary>
        /// Get row count of a specified folder's contents table.
        /// </summary>
        /// <param name="flags">The TableFlags parameter contains a bitmask of flags that control how information is returned in the table on folder.</param>
        /// <param name="inputHandle">The folder object handle.</param>
        /// <returns>Row count of the specified folder's contents table.</returns>
        protected uint GetContentsTable(FolderTableFlags flags, uint inputHandle)
        {
            RopGetContentsTableRequest request = new RopGetContentsTableRequest
            {
                RopId             = (byte)RopId.RopGetContentsTable,
                LogonId           = Constants.CommonLogonId,
                InputHandleIndex  = Constants.CommonInputHandleIndex,
                OutputHandleIndex = Constants.CommonOutputHandleIndex,
                TableFlags        = (byte)flags
            };
            RopGetContentsTableResponse response = this.Adapter.GetContentsTable(request, inputHandle, ref this.responseHandles);

            return(response.RowCount);
        }
        /// <summary>
        /// Retrieves the contents table for a folder.
        /// </summary>
        /// <param name="ropGetContentsTableRequest">RopGetContentsTableRequest object.</param>
        /// <param name="insideObjHandle">Server object handle in RopGetContentsTable.</param>
        /// <param name="responseSOHTable">Server objects handles in RopGetContentsTableResponse.</param>
        /// <returns>RopGetContentsTableResponse object.</returns>
        public RopGetContentsTableResponse GetContentsTable(RopGetContentsTableRequest ropGetContentsTableRequest, uint insideObjHandle, ref List <List <uint> > responseSOHTable)
        {
            object temp = new object();
            RopGetContentsTableResponse ropGetContentsTableResponse;
            bool contentsTableLocked = true;
            int  count      = 0;
            int  waitTime   = int.Parse(Common.GetConfigurationPropertyValue("WaitTime", this.Site));
            int  retryCount = int.Parse(Common.GetConfigurationPropertyValue("RetryCount", this.Site));

            do
            {
                this.ExcuteRopCall((ISerializable)ropGetContentsTableRequest, insideObjHandle, ref temp, ref responseSOHTable, ref this.rawData);
                ropGetContentsTableResponse = (RopGetContentsTableResponse)temp;

                // The contents table was locked by another database operation.
                if (ropGetContentsTableResponse.ReturnValue == 4294965994)
                {
                    Site.Log.Add(LogEntryKind.Comment, " JET_errTableLocked:" + ropGetContentsTableResponse.ReturnValue);
                    Thread.Sleep(waitTime);
                }
                else
                {
                    contentsTableLocked = false;
                }

                if (count > retryCount)
                {
                    break;
                }

                count++;
            }while (contentsTableLocked);

            #region Capture Code
            // The ReturnValue equal to 0x00000000 indicate ROP operation success
            if (0x00000000 == ropGetContentsTableResponse.ReturnValue)
            {
                this.VerifyRopGetContentsTable(ropGetContentsTableResponse);
            }
            #endregion

            return(ropGetContentsTableResponse);
        }