I get list Metadata for different SharepointLists from calling the Lists-Webservice:
[DocTemplateUrl] =>
[DefaultViewUrl] =>
[MobileDefaultViewUrl] =>
[ID] => {D33D2DEF-1404-4007-8D79-EE9EF75E5AC4}
[Title] => appdata
[Description] =>
[ImageUrl] => /_layouts/15/images/itgen.png?rev=23
[Name] => {D33D2DEF-1404-4007-8D79-EE9EF75E5AC4}
[BaseType] => 0
[FeatureId] =>
[ServerTemplate] => 125
[Created] => 20141006 14:46:58
[Modified] => 20141006 14:46:58
[LastDeleted] => 20141006 14:46:58
[Version] => 0
[Direction] => none
[ThumbnailSize] =>
[WebImageWidth] =>
[WebImageHeight] =>
[Flags] => 20756
[ItemCount] => 0
[AnonymousPermMask] => 0
[RootFolder] =>
[ReadSecurity] => 1
[WriteSecurity] => 1
[Author] => 3
[EventSinkAssembly] =>
[EventSinkClass] =>
[EventSinkData] =>
[EmailAlias] =>
[WebFullUrl] => /
[WebId] => 1f8e1fa6-d3fa-4393-98f5-deb4b3c89040
[SendToLocation] =>
[ScopeId] => 5c1f32b6-cb59-4ac8-b5ba-4eac5788c671
[MajorVersionLimit] => 0
[MajorWithMinorVersionsLimit] => 0
[WorkFlowId] =>
[HasUniqueScopes] => False
[NoThrottleListOperations] => False
[HasRelatedLists] =>
[Followable] => False
[AllowDeletion] => False
[AllowMultiResponses] => False
[EnableAttachments] => True
[EnableModeration] => False
[EnableVersioning] => False
[HasExternalDataSource] => False
[Hidden] => True
[MultipleDataList] => False
[Ordered] => False
[ShowUser] => True
[EnablePeopleSelector] => False
[EnableResourceSelector] => False
[EnableMinorVersion] => False
[RequireCheckout] => False
[ThrottleListOperations] => False
[ExcludeFromOfflineClient] => False
[CanOpenFileAsync] => True
[EnableFolderCreation] => True
[IrmEnabled] => False
[IsApplicationList] => False
[PreserveEmptyValues] => False
[StrictTypeCoercion] => False
[EnforceDataValidation] => False
[MaxItemsPerThrottledOperation] => 5000
Is it possible to add a new field to a list in Sharepoint? I don't want to add a column for the document attributes in a list, but add a field as a list metadata to retrieve it with the lists-webservice.
THX!
You can add existing site column, create a new site column, create a new list column and so on. Just pick your preference, in any normal case your would like to create a site column.
This can be done either by code, powershell or the SharePoint gui
PowerShell, http://adicodes.com/add-fields-to-list-with-powershell-in-sharepoint-2010/
Gui, https://www.youtube.com/watch?v=rvPDZ598Xxk
Code, http://msdn.microsoft.com/en-us/library/office/ms437580(v=office.15).aspx
But since you are asking this I suggest you keep to the GUI until you learn a bit more on SharePoint
Related
I want to be able to get notified when a server is down.
Puppet: sensu/sensu-puppet v5.9.0
Based on https://github.com/sensu/sensu-go/issues/1960, I tried this code without success.
Since there is a special static handler called "keepalive", I create a set handler "keepalive" and include my telegram handler (telegram_ops) in it.
BACKEND Code
class { 'sensu':
api_host => 'sensu3.mydomain.com',
password => '****',
agent_password => '****',
agent_entity_config_password => '****',
ssl_ca_source => 'puppet:///modules/common/ssl/ca.crt',
}
include sensu::cli
class { 'sensu::backend':
ssl_cert_source => 'puppet:///modules/common/ssl/my.crt',
ssl_key_source => 'puppet:///modules/common/ssl/my.key',
config_hash => {
'deregistration-handler' => 'deregistration',
'event-log-file' => '/var/log/sensu/events.log'
}
}
sensu_bonsai_asset { 'sensu/check-cpu-usage':
ensure => 'present',
version => 'latest',
}
sensu_check { 'check-cpu':
ensure => 'present',
labels => {'contacts' => 'ops'},
handlers => ['telegram_ops'],
command => 'check-cpu-usage -w 75 -c 85',
interval => 60,
subscriptions => 'linux',
publish => true,
runtime_assets => ['sensu/check-cpu-usage']
}
sensu_bonsai_asset { 'sensu/sensu-go-has-contact-filter':
ensure => 'present',
version => '0.2.0',
}
sensu_filter { 'contact_ops':
ensure => 'present',
action => 'allow',
runtime_assets => ['sensu/sensu-go-has-contact-filter'],
expressions => ['has_contact(event, "ops")'],
}
sensu_filter { 'first_occurrence':
ensure => 'present',
action => 'allow',
expressions => ['event.check.occurrences == 1'],
}
sensu_bonsai_asset { 'Thor77/sensu-telegram-handler':
ensure => 'present'
}
sensu_handler { 'telegram_ops':
ensure => 'present',
type => 'pipe',
command => 'sensu-telegram-handler --api-token **** --chatid -****',
timeout => 10,
runtime_assets => ['Thor77/sensu-telegram-handler'],
filters => [
'is_incident',
'not_silenced',
'contact_ops',
'first_occurrence'
],
}
sensu_handler { 'keepalive':
ensure => 'present',
type => 'set',
handlers => ['telegram_ops'],
}
AGENT Code (Very simple code.)
class { 'sensu::agent':
subscriptions => ['default', 'linux', $hostname, 'nuc']
}
It does not work. If I suddenly shutdown a server, nothing happeds.
What is the proper way to do this?
It is posible any other aproach?
Long time ago there was another solution, class sensu had the parameter client_keepalive but it is not available anymore.
Thanks.
I just started learning how to use the GitHub API. I wrote a sample program, to list my repositories. I have 5 repos, and I am only getting one. Any ideas?
My code:
<? php
DEFINE ('PERSONAL_TOKEN', 'xxxxxxxxxxxxxxxxx');
$headers = [
'Accept: application/vnd.github.v3+json',
'User-Agent: Some Text',
'Authorization: token '. PERSONAL_TOKEN
];
$res = list_repositories($headers);
print "<pre>";
print_r($res);
print "</pre>";
function list_repositories($headers)
{
$curl_url = GITHUB_REST_URL.'myusernameful'.'/repos';
$ch = curl_init($curl_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$res = json_decode(curl_exec($ch), TRUE);
curl_close($ch);
return $output;
}
I was expecting to get all 5 of my repos, instead, I am only getting one back:
Array
(
[0] => Array
(
[id] => 168594503
[node_id] => MDEwOlJlcG9zaXRvcnkxNjg1OTQ1MDM=
[name] => repo_one
[full_name] => myusername/repo_one
[private] =>
[owner] => Array
(
[login] => myusername
[id] => 45577729
[node_id] => MDQ6VXNlcjQ1NTc3NzI5
[avatar_url] => https://avatars1.githubusercontent.com/u/45577729?v=4
[gravatar_id] =>
[url] => https://api.github.com/users/myusername
[html_url] => https://github.com/myusername
[followers_url] => https://api.github.com/users/myusername/followers
[following_url] => https://api.github.com/users/myusername/following{/other_user}
[gists_url] => https://api.github.com/users/myusername/gists{/gist_id}
[starred_url] => https://api.github.com/users/myusername/starred{/owner}{/repo}
[subscriptions_url] => https://api.github.com/users/myusername/subscriptions
[organizations_url] => https://api.github.com/users/myusername/orgs
[repos_url] => https://api.github.com/users/myusername/repos
[events_url] => https://api.github.com/users/myusername/events{/privacy}
[received_events_url] => https://api.github.com/users/myusername/received_events
[type] => User
[site_admin] =>
)
[html_url] => https://github.com/myusername/repo_one
[description] => repo_one makes it easy and fast to build beautiful mobile apps.
[fork] => 1
[url] => https://api.github.com/repos/myusername/repo_one
[forks_url] => https://api.github.com/repos/myusername/repo_one/forks
[keys_url] => https://api.github.com/repos/myusername/repo_one/keys{/key_id}
[collaborators_url] => https://api.github.com/repos/myusername/repo_one/collaborators{/collaborator}
[teams_url] => https://api.github.com/repos/myusername/repo_one/teams
[hooks_url] => https://api.github.com/repos/myusername/repo_one/hooks
[issue_events_url] => https://api.github.com/repos/myusername/repo_one/issues/events{/number}
[events_url] => https://api.github.com/repos/myusername/repo_one/events
[assignees_url] => https://api.github.com/repos/myusername/repo_one/assignees{/user}
[branches_url] => https://api.github.com/repos/myusername/repo_one/branches{/branch}
[tags_url] => https://api.github.com/repos/myusername/repo_one/tags
[blobs_url] => https://api.github.com/repos/myusername/repo_one/git/blobs{/sha}
[git_tags_url] => https://api.github.com/repos/myusername/repo_one/git/tags{/sha}
[git_refs_url] => https://api.github.com/repos/myusername/repo_one/git/refs{/sha}
[trees_url] => https://api.github.com/repos/myusername/repo_one/git/trees{/sha}
[statuses_url] => https://api.github.com/repos/myusername/repo_one/statuses/{sha}
[languages_url] => https://api.github.com/repos/myusername/repo_one/languages
[stargazers_url] => https://api.github.com/repos/myusername/repo_one/stargazers
[contributors_url] => https://api.github.com/repos/myusername/repo_one/contributors
[subscribers_url] => https://api.github.com/repos/myusername/repo_one/subscribers
[subscription_url] => https://api.github.com/repos/myusername/repo_one/subscription
[commits_url] => https://api.github.com/repos/myusername/repo_one/commits{/sha}
[git_commits_url] => https://api.github.com/repos/myusername/repo_one/git/commits{/sha}
[comments_url] => https://api.github.com/repos/myusername/repo_one/comments{/number}
[issue_comment_url] => https://api.github.com/repos/myusername/repo_one/issues/comments{/number}
[contents_url] => https://api.github.com/repos/myusername/repo_one/contents/{+path}
[compare_url] => https://api.github.com/repos/myusername/repo_one/compare/{base}...{head}
[merges_url] => https://api.github.com/repos/myusername/repo_one/merges
[archive_url] => https://api.github.com/repos/myusername/repo_one/{archive_format}{/ref}
[downloads_url] => https://api.github.com/repos/myusername/repo_one/downloads
[issues_url] => https://api.github.com/repos/myusername/repo_one/issues{/number}
[pulls_url] => https://api.github.com/repos/myusername/repo_one/pulls{/number}
[milestones_url] => https://api.github.com/repos/myusername/repo_one/milestones{/number}
[notifications_url] => https://api.github.com/repos/myusername/repo_one/notifications{?since,all,participating}
[labels_url] => https://api.github.com/repos/myusername/repo_one/labels{/name}
[releases_url] => https://api.github.com/repos/myusername/repo_one/releases{/id}
[deployments_url] => https://api.github.com/repos/myusername/repo_one/deployments
[created_at] => 2019-01-31T20:50:56Z
[updated_at] => 2019-02-01T22:17:23Z
[pushed_at] => 2019-01-31T20:48:11Z
[git_url] => git://github.com/myusername/repo_one.git
[ssh_url] => git#github.com:myusername/repo_one.git
[clone_url] => https://github.com/myusername/repo_one.git
[svn_url] => https://github.com/myusername/repo_one
[homepage] => https://repo_one.io
[size] => 52581
[stargazers_count] => 0
[watchers_count] => 0
[language] => Dart
[has_issues] =>
[has_projects] => 1
[has_downloads] => 1
[has_wiki] => 1
[has_pages] =>
[forks_count] => 0
[mirror_url] =>
[archived] =>
[open_issues_count] => 0
[license] => Array
(
[key] => other
[name] => Other
[spdx_id] => NOASSERTION
[url] =>
[node_id] => MDc6TGljZW5zZTA=
)
[forks] => 0
[open_issues] => 0
[watchers] => 0
[default_branch] => master
[permissions] => Array
(
[admin] => 1
[push] => 1
[pull] => 1
)
)
)
The "List your Repositories" is /user/repos, not /users/:username/repos.
If you use your GitHub username in the URL (as in the latter case), you would get only your public repositories, not all your repos (public and private)
I have created a new module to add a new step to the signup process to get the user's phone number. Everything works fine, except the fact that after the signup, I need to grab the phone number I have received in my specific step and add it to the users table. For this purpose, I have added a hook in my module's manifest file as follows to be triggered after signup completes:
<?php
return array(
'package' =>
array(
'type' => 'module',
'name' => 'advancedsmsplugin',
'version' => '4.0.0',
'sku' => 'com.company.sms',
'path' => 'application/modules/Advancedsmsplugin',
'title' => 'Advanced SMS Plugin',
'description' => 'Advanced SMS Plugin',
'author' => 'Company Ltd.',
'callback' =>
array(
'class' => 'Engine_Package_Installer_Module',
),
'actions' =>
array(
0 => 'install',
1 => 'upgrade',
2 => 'refresh',
3 => 'enable',
4 => 'disable',
),
'directories' =>
array(
0 => 'application/modules/Advancedsmsplugin',
),
'files' =>
array(
0 => 'application/languages/en/advancedsmsplugin.csv',
1 => 'application/modules/User/Form/Signup/Phone.php',
2 => 'application/modules/User/Plugin/Signup/Phone.php',
),
),
'hooks' => array(
array(
'event' => 'onUserCreateAfter',
'resource' => 'User_Plugin_Phone',
),
),
);
?>
I have also created the class that I named in the hook namely User_Plugin_Phone and saved it as application/modules/user/Plugin/Phone.php.
class User_Plugin_Phone extends Core_Plugin_Abstract {
public function onUserCreateAfter($event) {
echo '<script>console.log("Inside User_Plugin_Phone::onUserCreateAfter");</script>';
echo '<script>alert("Inside User_Plugin_Phone: onUserCreateAfter");</script>';
$payload = $event->getPayload();
}
}
But, logs show that the hook is not triggered at all. I have checked this and this, and I think I have followed them correctly. Any ideas why this does not work]?
I am trying to make request to OneDrive, but so far no success. I have been able to obtain access token that I think is good because I can access informations from https://graph.microsoft.com/v1.0/me. But when I try to access https://graph.microsoft.com/v1.0/me/drive I get 500 error response, this is what response object says:
[message:protected] => Unable to resolve template token
[string:Exception:private] =>
[code:protected] => 500
[file:protected] => C:\xampp\htdocs\OneDrive\vendor\thenetworg\oauth2-azure\src\Provider\Azure.php
[line:protected] => 68
[trace:Exception:private] => Array
(
[0] => Array
(
[file] => C:\xampp\htdocs\OneDrive\vendor\league\oauth2-client\src\Provider\AbstractProvider.php
[line] => 644
[function] => checkResponse
[class] => TheNetworg\OAuth2\Client\Provider\Azure
[type] => ->
[args] => Array
(
[0] => GuzzleHttp\Psr7\Response Object
(
[reasonPhrase:GuzzleHttp\Psr7\Response:private] => Internal Server Error
[statusCode:GuzzleHttp\Psr7\Response:private] => 500
[headers:GuzzleHttp\Psr7\Response:private] => Array
(
[Cache-Control] => Array
(
[0] => private
)
[Transfer-Encoding] => Array
(
[0] => chunked
)
[Content-Type] => Array
(
[0] => application/json
)
[request-id] => Array
(
[0] => 7fc5c1c8-bd33-4788-bae9-5887d261c8c5
)
[client-request-id] => Array
(
[0] => 7fc5c1c8-bd33-4788-bae9-5887d261c8c5
)
[x-ms-ags-diagnostic] => Array
(
[0] => {"ServerInfo":{"DataCenter":"West Europe","Slice":"SliceB","ScaleUnit":"003","Host":"AGSFE_IN_2","ADSiteName":"AMS"}}
)
[Duration] => Array
(
[0] => 177.0851
)
[Date] => Array
(
[0] => Mon, 06 Feb 2017 12:55:27 GMT
)
)
[headerNames:GuzzleHttp\Psr7\Response:private] => Array
(
[cache-control] => Cache-Control
[transfer-encoding] => Transfer-Encoding
[content-type] => Content-Type
[request-id] => request-id
[client-request-id] => client-request-id
[x-ms-ags-diagnostic] => x-ms-ags-diagnostic
[duration] => Duration
[date] => Date
)
[protocol:GuzzleHttp\Psr7\Response:private] => 1.1
[stream:GuzzleHttp\Psr7\Response:private] => GuzzleHttp\Psr7\Stream Object
(
[stream:GuzzleHttp\Psr7\Stream:private] => Resource id #79
[size:GuzzleHttp\Psr7\Stream:private] => 237
[seekable:GuzzleHttp\Psr7\Stream:private] => 1
[readable:GuzzleHttp\Psr7\Stream:private] => 1
[writable:GuzzleHttp\Psr7\Stream:private] => 1
[uri:GuzzleHttp\Psr7\Stream:private] => php://temp
[customMetadata:GuzzleHttp\Psr7\Stream:private] => Array
(
)
)
)
[1] => Array
(
[error] => Array
(
[code] => InternalServerError
[message] => Unable to resolve template token
[innerError] => Array
(
[request-id] => 7fc5c1c8-bd33-4788-bae9-5887d261c8c5
[date] => 2017-02-06T12:55:28
)
)
)
)
)
Problem was that I was using thephpleague/oauth2 package that is recommended by official docs. Links to token and authorize URL were not to the v2.0 endpoint.
Dear Brantree Developer(s) , I am trying to implement the braintree payments in my website and braintree has given Response in object of array with nested object How can i access it?. i want to get id of customer from bellow response.
Braintree_Result_Successful Object
(
[success] => 1
[_returnObjectNames:private] => Array
(
[0] => customer
)
[_attributes] => Array
(
)
[customer] => Braintree_Customer Object
(
[_attributes:protected] => Array
(
[id] => 22635830
[merchantId] => h9xhpt9b5zjgbkpj
[firstName] => Abhishek
[lastName] => Sonawane
[company] => 1
[email] => abhishek#iarianatech.com
[phone] =>
[fax] =>
[website] =>
[createdAt] => DateTime Object
(
)
[updatedAt] => DateTime Object
(
)
[customFields] =>
[creditCards] => Array
(
[0] => Braintree_CreditCard Object
(
[_attributes] => Array
(
[bin] => 510510
[expirationMonth] => 12
[expirationYear] => 2015
[last4] => 5100
[cardType] => MasterCard
[cardholderName] =>
[commercial] => Unknown
[countryOfIssuance] => Unknown
[createdAt] => DateTime Object
(
)
[customerId] => 22635830
[customerLocation] => US
[debit] => Unknown
[default] => 1
[durbinRegulated] => Unknown
[expired] =>
[healthcare] => Unknown
[imageUrl] => https://assets.braintreegateway.com/payment_method_logo/mastercard.png?environment=sandbox
[issuingBank] => Unknown
[payroll] => Unknown
[prepaid] => Unknown
[subscriptions] => Array
(
)
[token] => 6k2mk2
[uniqueNumberIdentifier] => 0ec6bdfe18781d1bccaea74c4fe55897
[updatedAt] => DateTime Object
(
)
[venmoSdk] =>
[verifications] => Array
(
)
[billingAddress] =>
[expirationDate] => 12/2015
[maskedNumber] => 510510******5100
)
)
)
[addresses] => Array
(
)
[coinbaseAccounts] => Array
(
)
[paypalAccounts] => Array
(
)
[applePayCards] => Array
(
)
)
)
)
Full disclosure: I work at Braintree. If you have any further questions, feel free to contact support.
It looks like that response is coming from a Customer create call. To specifically retrieve the id -
$result = Braintree_Customer::create([
'firstName' => 'Mike',
'lastName' => 'Jones',
'company' => 'Jones Co.',
'email' => 'mike.jones#example.com',
'phone' => '281.330.8004',
'fax' => '419.555.1235',
'website' => 'http://example.com'
]);
$result->success;
# true
$id = $result->customer->id;
Check the API Response section of the guides for getting other attributes.