Software Development Kit (SDK) and API Discussions

C# Syntax for adding Useradmin Role and Group (7-mode)

JahRiddim

Hello, Everyone.

 

I'm still a beginner with C# and programming in general, so excuse my ignorance. I have created a C-mode application that scans the NetApp devices, verifies if certain pre-reqs are met, and if not met will assist the user in meeting those pre-reqs. I need to do the same for 7-mode (1.20) but I'm getting stuck on 'useradmin-role-add' and 'useradmin-group-add' (which did not give me trouble in c-mode).

 

I created the query via Zedi and copied it straight from the developer tab with minor adjustments (role variable being a role name the user desires and 'comments' child removed). Here's my code below:

 

try
		 {
			NaServer s = new NaServer("<server name or IP address>", 1 , 20);
			s.ServerType = NaServer.SERVER_TYPE.FILER;
			s.TransportType = NaServer.TRANSPORT_TYPE.HTTPS;
			s.Port = 443;
			s.Style = NaServer.AUTH_STYLE.LOGIN_PASSWORD;
			s.SetAdminUser("<user name>", "<password>");


			NaElement api = new NaElement("useradmin-role-add");

			NaElement xi = new NaElement("useradmin-role");
			api.AddNewChild(xi);

			NaElement xi1 = new NaElement("useradmin-role-info");
			xi.AddNewChild(xi1);

			NaElement xi2 = new NaElement("allowed-capabilities");
			xi1.AddNewChild(xi2);

			NaElement xi3 = new NaElement("useradmin-capability-info");
			xi2.AddNewChild(xi3);
			xi3.AddNewChild("name","login-* api-*");
			xi1.AddNewChild("name", role);

			NaElement xo = s.InvokeElem(api);
			Console.WriteLine(xo.ToPrettyString(""));


		} catch blah blah blah....

The error in Visual Studio is "xi#.AddNewChild(xi#)"  fails due to, "There is no arguement given that corresponds to the required formal parameter 'content' of NaElement.AddNewChild(string,string)." This appears to be the same when attempting to create a new group as well.

 

I can give the AddNewChild("<ElementName>", "<ElemContent>")  which allows my solution to build, but does not produce any results.  As you can see I am also invoking using InvokeElem.

 

Again, pardon my ignorance if this is a simple solution, this is the first 'real' application I have been building so any help is appreciated. Thanks!!!

0 REPLIES 0
Announcements
NetApp on Discord Image

We're on Discord, are you?

Live Chat, Watch Parties, and More!

Explore Banner

Meet Explore, NetApp’s digital sales platform

Engage digitally throughout the sales process, from product discovery to configuration, and handle all your post-purchase needs.

NetApp Insights to Action
I2A Banner
Public