Veröffentlicht Mon, 16 Jul 2018 12:06:18 GMT von Seth Jaco Support Specialist

I am needing to export the list of users for one of our cloud clients. I figured I would need to do this through the API but am unsure of where to start. Any help would be appreciated.

Thanks,
Seth

Veröffentlicht Mon, 16 Jul 2018 12:25:07 GMT von Joe Kaufman Bell Laboratories Inc No longer there

Seth,

If you can use the .NET libraries via C#, this static method can gather a list of groups and users for an Organization instance:

======================

        public static string GetGroupsUsersList(Organization org)
        {
            if (org == null) { return "(No Organization connected...)"; }
            StringBuilder list = new StringBuilder();
            list.AppendLine("Organization: " + org.Name.ToUpper().Trim());
            list.AppendLine();
            var groups = org.GetGroupsFromGroupsRelation().Item;
            groups = groups.OrderBy(g => g.Name).ToList();
            foreach (Group group in groups)
            {
                list.AppendLine(group.Name.ToUpper().Trim() + " Users:");
                list.AppendLine(VFP.REPLICATE('=', group.Name.Length + 7));
                var users = group.GetUsersFromUsersRelation().User;
                users = users.OrderBy(u => u.Name).ToList();
                foreach (User user in users)
                {
                    list.AppendLine(user.Name.Trim() + " (" + ((user.FirstName != null ? user.FirstName : "") + " " + (user.LastName != null ? user.LastName : "")).Trim() + ")");
                }
                list.AppendLine();
            }
            return list.ToString();
        }

======================

You can ignore the VFP.REPLICATE stuff -- that is a library I made to perform certain VFP functions by a name I was used to. You can format the textual output however you want, or store user information in a different data structure, such as List<User>.

If you need to do this via a non-.NET web request, I have not done that. But there should be a resource for it that returns users as XML or JSON

Finally, if you are on-premise, hitting the SQL Server data directly is your best bet for getting a complete look at groups, users, and permissions. The Platform SDK does not have a lot of deeper information with regard to permissions, but the SQL Server data can be pieced together (though that is probably all broken if I ever went to DW 7.0 since they changed the data model a lot). I have an example of a simple user listing with some security information if you want to see what those queries look like and what tables they hit.

Hope this helps!

 

Thanks,

Joe Kaufman

Veröffentlicht Mon, 16 Jul 2018 13:08:10 GMT von Seth Jaco Support Specialist

I had seen a similar example of this from one of your earlier posts, I just didn't know how to get it going. I have an ASMX page that I use to import data into the system from a .CSV file and didn't know if I could use that to also pull the list of users as well, however, I cannot get it to use my web.config file that has all of my connection information in it. 

Thanks

 

Thanks

Veröffentlicht Mon, 16 Jul 2018 13:43:09 GMT von Joe Kaufman Bell Laboratories Inc No longer there

Seth,

I am not all that well-versed in ASMX development, but if it is C# on the behind-the-page scripting, you should be able to download the DocuWare NuGet packages and be able to use their types: Organization, ServiceConnection, etc. You could hard-code a username and password directly into that code to establish a conneciton and get back an Organization object. Then you pass that to the sample code and it can access groups and lists. Getting it into a format usable by you is just a matter of coding the iteration through the Groups and Users collections to place data where you want it. You could add your own delimiters to make a file openable in Excel.

Is the environment C# and in Visual Studio? Could you simply make a Windows Desktop app to do this for you? I built one for the Fortis conversion, and it establishes connections, etc via a DocuWare username/password or Windows passthrough authentication. The .NET libraries make DocuWare API programming pretty simple.

Thanks,
Joe Kaufman

Veröffentlicht Mon, 16 Jul 2018 13:49:13 GMT von Seth Jaco Support Specialist

It is in C# and I am using Visual Studio to build everything. I have thought about making a Windows Desktop app to do it but once again I am just too new at this stuff :) 

Veröffentlicht Mon, 16 Jul 2018 13:59:08 GMT von Joe Kaufman Bell Laboratories Inc No longer there

Seth,

If you create a Wndows Forms app (know that the tech for that is considered outdated, but it still works), it starts you off with a single form that will display when you run the app. Just put a button on there and start by putting everything in the Click event. You can refactor later to separate code out and be more organized. But this will get your feet wet.

You can download the NuGet packages based on the instructions here:

http://help.docuware.com/sdk/platform/html/66b2ed1e-2aef-452a-97cd-5014bbf0242b.htm

and from there you just need to "using" the DocuWare modules so that all the types become available (and turn blue, etc. as you type). There are more examples if you drill down from the link above, such as setting up your first connection:

http://help.docuware.com/sdk/platform/html/8ecbfe35-9182-4acc-833e-ac0f1857347e.htm

Learning how to create a whole application in C# is a whole thing, for sure, but I bet you can come up with an application that can perform basic operations that you want, building yourself a little toolbox. You may need to place some of the DocuWare .NET DLL files alongside the resulkting executable after you do a build, but then you have yourself a Windows application that you can customize to do anything you need! There isn;t really any other shortcut for this when it comes to using the Platform Service -- it's custom coding time.

 

Thanks,

Joe Kaufman

Veröffentlicht Mon, 16 Jul 2018 16:09:57 GMT von Seth Jaco Support Specialist

I will give this a go and see what I can find out, thank you for pointing me in the right direction.

Veröffentlicht Mon, 16 Jul 2018 16:30:00 GMT von Seth Jaco Support Specialist

Disregard, found out my issue. Thanks :)

Veröffentlicht Mon, 16 Jul 2018 16:56:51 GMT von Joe Kaufman Bell Laboratories Inc No longer there

Let me guess -- you had the username and password switched? I tihnk I had that happen for a while, or maybe that was in URL Integration...

If you have a ServiceConnection up and running, you are almost there!

 

Thanks,

Joe Kaufman

Veröffentlicht Mon, 16 Jul 2018 17:04:40 GMT von Seth Jaco Support Specialist

Yep the connection works just fine, now I am trying to list the file cabinets just to see if I can get data.

Veröffentlicht Mon, 16 Jul 2018 17:14:00 GMT von Joe Kaufman Bell Laboratories Inc No longer there

Seth,

You will want to get the Organization, first:

Organization org = DWConn.Organizations[0];

assuming "DWConn" is your ServiceConnection instance and you only have one organization on the server you are authenticated to (zero-indexed array, so zero equals the first one).

And then you can do something like this with the Organizaiton instance:

List<FileCabinet> fileCabinets = org.GetFileCabinetsFromFilecabinetsRelation().FileCabinet;
foreach (FileCabinet fc in fileCabinets)
{
    if (!fc.IsBasket)
    {
        lvAddedItem = lvFileCabinets.Items.Add(fc.Name, 0);
        lvAddedItem.SubItems.Add(fc.Id);
    }
}
 

lvFileCabinets is a ListView control I have on my form. You can put the name of the file cabinet wherever you want. The main fields you will want from a FileCabinet object are Name and Id (the guid).

 

Thanks,

Joe Kaufman

Veröffentlicht Mon, 16 Jul 2018 17:16:00 GMT von Seth Jaco Support Specialist

One thing I keep running into is in their examples they always have conn.blahblahblah, yet conn does not exits anywhere and if I create it then the blahblahblah(section after the period) doesn't work. Am I missing something?

var org = conn.Organizations[0];

Veröffentlicht Mon, 16 Jul 2018 17:29:38 GMT von Joe Kaufman Bell Laboratories Inc No longer there

Seth,

"conn" is an instance of a type (or an "object" of a "class" in some nomenclature).

If you create a "conn" variable and then go after Organizations right after, it should work, so I am not sure what you mean by the section after the period not working. This just sounds like a variable scope issue. If you create "conn" in a click event method and then elsewhere in the form try to use "conn" (without passing it in as a parameter) it won't work. That is why some of my examples are things like "DWConn" where DWConn is actually a form-level property declared at the top of the form like:

        private ServiceConnection DWConn = null;
        private Organization DWOrganization = null;

When declared at that level, the editor recognizes them even without a "this" keyword in front. I use form-level member variables for thngs that need to be accessible everywhere on the form, and the connection and organization get instanced upon connecting.

 

Thanks,

Joe Kaufman

Veröffentlicht Mon, 16 Jul 2018 17:33:36 GMT von Seth Jaco Support Specialist

Gotcha, thank you for the help again. 

Sie müssen angemeldet sein um Beiträge in den Foren zu erstellen.