You are viewing limited content. For full access, please sign in.

Question

Question

How to get a list of Entries Locked.

SDK
asked on July 28, 2015

Hi there, 

I'm trying to get a list of Entries Locked with the fallowing code: 

 

        static void Main(string[] args)
        {
            RepositoryRegistration repositorio = new RepositoryRegistration("xxxx", "xxxxx");
            Session session = new Session();

            session.LogIn("xxxxx", "xxxx", repositorio);
            
            EntryLockListing lockListRow = EntryLockListing.GetListing(session);

            foreach (EntryLockListingRow rowItem in lockListRow)
            {
                Console.WriteLine("NOME DO CONTRATO: " + rowItem.EntryName);
                Console.WriteLine("DATA DE CRIAÇÃO: " + rowItem.CreationTime);
            }

            lockListRow.Dispose();
            session.LogOut();
        }

But the 

EntryLockListing.GetListing(session);

ruturns nothing. Can you guys tell me where am i wrong ?

1 0

Answer

SELECTED ANSWER
replied on August 10, 2015 Show version history

try this

foreach (EntryLockListingRow rowItem in lockListing)
{
    try
    {
        Entry.Unlock(rowItem.EntryId, rowItem.LockToken, session);
    }
    catch (Exception ex)
    {
        MessageBox.Show(ex.Message);
    }
}

 

3 0

Replies

replied on July 28, 2015

Try:

using (var lockListing = EntryLockListing.GetListing(100,
    new EntryLockListingSettings {PersistentLocksOnly = false},
    session))
{
    foreach (EntryLockListingRow row in lockListing)
    {
        // ...
    }
}

 

1 0
replied on July 28, 2015

Pass in an EntryLockListingSettings with PersistentLocksOnly=false to return temporary locks. "Persistent locks" are when you manually check out a document, whereas temporary locks are when you modify a document without checking it out first. Also the IdentityReference and SessionId parameters on EntryLockListingSettings allow you to narrow down the listing based on who holds the lock.

0 0
replied on August 7, 2015

Michael Allen thanks for your help and Robert Strickland! My code works now!! 

And now i'll try to force the realese lock on those entries. 

0 0
replied on August 10, 2015 Show version history

Hi Michael Allen, 

What I need is to unlock every single entry in the list, that's my goal !

            try
            {
                using (var locklisting = EntryLockListing.GetListing(100, new EntryLockListingSettings { PersistentLocksOnly = false }, session))
                {                    
                    foreach (EntryLockListingRow rowItem in locklisting)
                    {

                        DocumentInfo docInfo = Document.GetDocumentInfo(rowItem.EntryId, session);
                        docInfo.Dispose();
                    }
                }
            }
            catch (Exception ex)
            {

                throw;
            }

 

0 0
replied on August 10, 2015

Hi Bert Warren,

I'll try and after it i give you feedback. 

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.