-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.php
64 lines (50 loc) · 1.88 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
/*
* @author
* Eswar Rajesh Pinapala | [email protected]
* Developed for eBay internal use.
*/
//set the timestamp
define(
'd',
date(
"m/d/Y H:i:s"
)
);
//concatenate src and utils to the include path on the fly
set_include_path(get_include_path() .
PATH_SEPARATOR .
"src" .
PATH_SEPARATOR .
"utils"
);
//parse the config file
$config = parse_ini_file(
"config.ini",
true
);
include_once "LiveIDManager.php";
include_once "EntityUtils.php";
include_once 'PrintUtils.php';
include_once 'CrmAPIContext.php';
$liveIDUseranme = $config["dynamics"]["crmUserId"];
$liveIDPassword = $config["dynamics"]["crmPassword"];
$organizationServiceURL = $config["dynamics"]["organizationServiceURL"];
$liveIDManager = new LiveIDManager();
$securityData = $liveIDManager->authenticateWithLiveID($organizationServiceURL, $liveIDUseranme, $liveIDPassword);
if ($securityData != null && isset($securityData)) {
echo ("\nKey Identifier:" . $securityData->getKeyIdentifier());
echo ("\nSecurity Token 1:" . $securityData->getSecurityToken0());
echo ("\nSecurity Token 2:" . $securityData->getSecurityToken1());
} else {
echo "Unable to authenticate LiveId.";
return;
}
echo "\n";
$dynamicsCrm = new CrmAPIContext();
$accountId = $dynamicsCrm->createOrg($organizationServiceURL, $securityData, "New Org created by Rajesh\'s app" . d );
PrintUtils::dump($dynamicsCrm->readOrg($accountId, $organizationServiceURL, $securityData));
$dynamicsCrm->updateOrg($accountId, $organizationServiceURL, $securityData, "New Org name Updated by Rajesh\'s app_" . d);
PrintUtils::dump($dynamicsCrm->readOrg($accountId, $organizationServiceURL, $securityData));
//Uncomment only if you want to delete the created org
//$dynamicsCrm->deleteOrg($accountId, $organizationServiceURL, $securityData);