Returns an array of all users working on the project. You specify the needed project using the ProjId
value of the AuthenticationData
object you pass in a request.
Parameters
The operation uses the following parameter
AuthenticationData : AuthenticationData, required
An AuthenticationData
object containing the login information and the ID of the project whose users you want to get.
Result
An array of User
objects that contain information on the users working on the specified project.
Example
Sample Code
C#
string login = "[email protected]";
string password = "p@ssword";
// The ID of the project whose users you want to get
int projId = 1032;
ServiceSoapClient service = new ServiceSoapClient();
// Prepare authentication data
LoginInfo loginInfo = service.GetLoginInfo("", login, password);
AuthenticationData authData = new AuthenticationData();
authData.AppCode = loginInfo.AppCode;
authData.UserId = loginInfo.UserId;
authData.DeptId = loginInfo.DeptId;
authData.PassCode = password;
authData.ProjId = projId;
// Get an array of users
User[] users = service.User_GetByProject(authData);
foreach (User user in users)
{
Console.WriteLine(user.Email);
}
Java
String login = "[email protected]";
String password = "p@ssword";
// The ID of the project whose users you want to get
int projId = 1032;
ServiceSoap service = new Service().getServiceSoap12();
// Prepare authentication data
LoginInfo loginInfo = service.getLoginInfo("", login, password);
AuthenticationData authData = new AuthenticationData();
authData.setAppCode(loginInfo.getAppCode());
authData.setUserId(loginInfo.getUserId());
authData.setPassCode(password);
authData.setDeptId(loginInfo.getDeptId());
authData.setProjId(projId);
// Get an array of users
List<User> users = service.usersGetByProject(authData).getUser();
for (User user : users)
{
System.out.format(user.getEmail());
}
Sample Request XML
POST /psws/psws.asmx HTTP/1.1
Host: myteam.mysite.com
Content-Type: text/xml; charset=utf-8
Content-Length: 478 {Insert an appropriate value here}
SOAPAction: "http://www.pragmaticsw.com/User_GetByProject"
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<User_GetByProject xmlns="http://www.pragmaticsw.com/">
<AuthenticationData>
<AppCode>agSP</AppCode>
<DeptId>7154</DeptId>
<ProjId>1032</ProjId>
<UserId>25315</UserId>
<PassCode>p@ssword</PassCode>
</AuthenticationData>
</User_GetByProject>
</soap:Body>
</soap:Envelope>
SOAP 1.2
POST /psws/psws.asmx HTTP/1.1
Host: myteam.mysite.com
Content-Type: application/soap+xml; charset=utf-8
Content-Length: 486 {Insert an appropriate value here}
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<User_GetByProject xmlns="http://www.pragmaticsw.com/">
<AuthenticationData>
<AppCode>agSP</AppCode>
<DeptId>7154</DeptId>
<ProjId>1032</ProjId>
<UserId>25315</UserId>
<PassCode>p@ssword</PassCode>
</AuthenticationData>
</User_GetByProject>
</soap12:Body>
</soap12:Envelope>
Sample Response XML
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: 642 {The server returns an appropriate value here}
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<User_GetByProjectResponse xmlns="http://www.pragmaticsw.com/">
<User_GetByProjectResult>
<User>
<UserId>24661</UserId>
<FirstName>John</FirstName>
<LastName>Smith</LastName>
<Email>[email protected]</Email>
</User>
<User>
<UserId>24697</UserId>
<FirstName>Tara</FirstName>
<LastName>Salinas</LastName>
<Email>[email protected]</Email>
</User>
</User_GetByProjectResult>
</User_GetByProjectResponse>
</soap:Body>
</soap:Envelope>
SOAP 1.2
HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: 652 {The server returns an appropriate value here}
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<User_GetByProjectResponse xmlns="http://www.pragmaticsw.com/">
<User_GetByProjectResult>
<User>
<UserId>24661</UserId>
<FirstName>John</FirstName>
<LastName>Smith</LastName>
<Email>[email protected]</Email>
</User>
<User>
<UserId>24697</UserId>
<FirstName>Tara</FirstName>
<LastName>Salinas</LastName>
<Email>[email protected]</Email>
</User>
</User_GetByProjectResult>
</User_GetByProjectResponse>
</soap12:Body>
</soap12:Envelope>
See Also
User_Add
User_GetEmailById
GetLoginInfo
GetLoginInfoByEntity
Users Operations
SOAP API Reference