Currently I need to create a folder on a Sharepoint repository using it CMIS implementation so I am using the web services it offers on the path http://(server)/_vti_bin/cmis/soap. I implemented the code based on this example https://chemistry.apache.org/java/opencmis-cookbook.html but Sharepoint does not return the rootFolderId so the method getChildren returns nothing. Finally based on a query using the discovery service I retrieve the root folder id, but now the problem is I can't create a sub folder. This is my code:
Object.cmisPropertyId p1 = new Object.cmisPropertyId();
p1.propertyDefinitionId = "cmis:baseTypeId";
p1.value = new string[1];
p1.value[0] = "cmis:folder";
propertiesType.Items.SetValue(p1, 0);
Object.cmisPropertyString p2 = new Object.cmisPropertyString();
p2.propertyDefinitionId = "cmis:name";
p2.value = new string[1];
p2.value[0] = "mytest";
propertiesType.Items.SetValue(p2, 1);
Object.cmisPropertyString p3 = new Object.cmisPropertyString();
p3.propertyDefinitionId = "cmis:path";
p3.value = new string[1];
p3.value[0] = "Rep/f1/mytest";
propertiesType.Items.SetValue(p3, 2);
Object.cmisPropertyId p4 = new Object.cmisPropertyId();
p4.propertyDefinitionId = "cmis:objectTypeId";
p4.value = new string[1];
p4.value[0] = "cmis:folder";
propertiesType.Items.SetValue(p4, 3);
Object.cmisPropertyId p5 = new Object.cmisPropertyId();
p5.propertyDefinitionId = "cmis:parentId";
p5.value = new string[1];
p5.value[0] = "268";
propertiesType.Items.SetValue(p5, 4);
Object.cmisPropertyString p6 = new Object.cmisPropertyString();
p6.propertyDefinitionId = "Author";
p6.value = new string[1];
p6.value[0] = "theAuthor";
propertiesType.Items.SetValue(p6, 5);
Object.cmisPropertyId p7 = new Object.cmisPropertyId();
p7.propertyDefinitionId = "cmis:allowedChildObjectTypeIds";
p7.value = new string[3];
p7.value[0] = "cmis:document";
p7.value[1] = "0x010100C98D402E3C78834C873469CE4F41E2C300B0A3B5E8A3E51543977DFDCE95850082";
p7.value[2] = "cmis:folder";
propertiesType.Items.SetValue(p7, 6);
var result = objectService.createFolder(repositoryInfo.repositoryId, propertiesType, null, null, null, null, ref extType);
It always return null, I'm not sure how to pass correctly the arguments to the service for make the creation works. I don't know where to find logs o something that tell me what I am doing wrong.
Thank you
PD: I need to use this aproach because is a modification to an existing code that already use the Sharepoint CMIS services.
You try to update readonly properties. See CMIS 1.0
http://docs.oasis-open.org/cmis/CMIS/v1.1/CMIS-v1.1.html
Sample on Java
Folder root = session.getRootFolder();
Map<String, Object> properties = new HashMap<String, Object>();
properties.put(PropertyIds.OBJECT_TYPE_ID, "cmis:folder");
properties.put(PropertyIds.NAME, "a new folder");
Folder newFolder = root.createFolder(properties);
The key is "session". You should create session to CMIS Repository(Atom or WSDL binding). Session will provide you ability to create/retrieve folders/documents
Related
I am trying to replicate the post request as given in the doc: https://learn.microsoft.com/en-us/rest/api/azure/devops/git/pushes/create?view=azure-devops-rest-5.0#update_a_file
using the .Net libraries for making an extension.
I have checked that the refUpdate and OldObjectId are correct through trial and error.
changes, item, repo are all defined and not null.
GitPush push = new GitPush();
GitCommit gitCommit = new GitCommit();
GitChange change = new GitChange();
ItemContent content = new ItemContent();
content.Content = changeString;
content.ContentType = ItemContentType.RawText;
change.NewContent = new ItemContent();
change.ChangeType = VersionControlChangeType.Edit;
change.Item = item;
List<GitChange> changes = new List<GitChange>();
changes.Add(change);
gitCommit.Changes = changes;
gitCommit.Comment = "updated app.cpp";
GitRefUpdate refUpdate = new GitRefUpdate();
refUpdate.Name = "refs/heads/dev";
refUpdate.OldObjectId = oldObjectId;
List<GitCommit> commits = new List<GitCommit>();
commits.Add(gitCommit);
List<GitRefUpdate> refUpdates = new List<GitRefUpdate>();
refUpdates.Add(refUpdate);
push.Commits = commits;
push.RefUpdates = refUpdates;
GitPush pushed = gitClient.CreatePushAsync(push, repo.Id).Result;
On the last line the debugger gives the exception that parameter "newPush" is not defined.
I am updating journal entry on Net suite using suite talk API.
I can add new lines for the record. but on updating existing line using line ID in am getting below error.
You do not have permissions to set a value for element line.line due to one of the following reasons: 1) The field is read-only; 2) An associated feature is disabled; 3) The field is available either when a record is created or updated, but not in both cases.
i can update lines using GUI but not using API
NetSuiteServiceBridge nsServiceBridge = NetSuiteServiceBridge.serviceInstance;
JournalEntry j = new JournalEntry();
//j.subsidiary =new RecordRef {internalId="2",type=RecordType.subsidiary };
j.internalId = "115939";
JournalEntryLineList jl = new JournalEntryLineList();
JournalEntryLine line1 = new JournalEntryLine();
line1.startDate = DateTime.Now;
line1.startDateSpecified = true;
line1.line = 5;
line1.lineSpecified = true;
line1.account = new RecordRef { internalId = "206", type = RecordType.account };
line1.department = new RecordRef { internalId = "1", type = RecordType.department };
line1.credit = 100;
line1.creditSpecified = true;
jl.line = new JournalEntryLine[] {line1};
jl.replaceAll = false;
j.lineList = jl;
WriteResponse r= nsServiceBridge.UpdateRecords(j);
Web Services has its own permissions separate the the native GUI
This is by design
I was trying to create a build definition. I tried as below one.
But i do think the code below doesn't create a buildDefinition. Like it asks for BuildDefinitionRef in the code "newBuild["BuildDefinition"] = ;" I am unable to know what exactly to put which reference.
RallyRestApi RestApi = new RallyRestApi("_abcd","https://rally1.rallydev.com");
String workspaceRef = "/workspace/27154845988";
String projectRef = "/project/48152113168";
DynamicJsonObject newBuild = new DynamicJsonObject();
newBuild["Workspace"] = workspaceRef;
newBuild["Duration"] = 0.75;
newBuild["Message"] = "Master 4683 Success";
//newBuild["CreationDate"] = "";
newBuild["Status"] = "FAILURE";
newBuild["Number"] = "4683";
// newBuild["Uri"] = "http://jenkins-build:8080/hudson/view/master/job/master-deploy/4683/";
// newBuild["BuildDefinition"] = ;
If any body has any idea of first how to create the BuildDefinition.
BuildDefinition should be a createable type in WSAPI. You just need to create that first, and then when you're creating your Build object just pass the ref of the created BuildDefinition:
newBuild["BuildDefinition"] = "/builddefinition/12345";
I have an Amazon EC2 instance and I need to be able to create an AMI (image) from it programmatically. I'm trying the following:
CreateImageRequest rq = new CreateImageRequest();
rq.InstanceId = myInstanceID;
rq.Name = instance.KeyName;
rq.Description = "stam";
rq.NoReboot = true;
IAmazonEC2 ec2;
AmazonEC2Config ec2conf = new AmazonEC2Config();
ec2 = AWSClientFactory.CreateAmazonEC2Client(ec2conf);
// CreateImageResponse imageResp;
Amazon.EC2.Model.CreateImageResponse imageResp = null;
try
{
imageResp = ec2.CreateImage(rq);
}
catch (AmazonServiceException ase)
{
MessageBox.Show(ase.Message);
}
The result is always an AmazonServiceException saying that there is a NameResolutionFailure.
How do I overcome this? I tried different possible "name" possibilities but cannot find the right one.
string amiID = ConfigurationManager.AppSettings[AmazonConstants.AwsImageId];
string keyPairName = ConfigurationManager.AppSettings[AmazonConstants.AwsKeyPair];
List<string> groups = new List<string>() { ConfigurationManager.AppSettings[AmazonConstants.AwsSecurityGroupId] };
var launchRequest = new RunInstancesRequest()
{
ImageId = amiID,
InstanceType = ConfigurationManager.AppSettings[AmazonConstants.AwsInstanceType],
MinCount = 1,
MaxCount = 1,
KeyName = keyPairName,
SecurityGroupIds = groups,
SubnetId = ConfigurationManager.AppSettings[AmazonConstants.AwsSubnetId]
};
RunInstancesResponse runInstancesResponse = amazonEc2client.RunInstances(launchRequest);
RunInstancesResult runInstancesResult = runInstancesResponse.RunInstancesResult;
Reservation reservation = runInstancesResult.Reservation;
Problem eventually solved!
it turned out thyat some codelines were doing things which were already done already and removing this part:
IAmazonEC2 ec2;
AmazonEC2Config ec2conf = new AmazonEC2Config();
ec2 = AWSClientFactory.CreateAmazonEC2Client(ec2conf);
// CreateImageResponse imageResp;
Amazon.EC2.Model.CreateImageResponse imageResp = null;
Made things clearer and no wrong repetitions happened! Now it works!
When I'm trying to Request the Competettive Price for a Product i always get a
MarketplaceWebServiceProductsException
The Message is empty, and the TargetSite gives me
T Call[T](MWSClientCsRuntime.IMwsRequestType1[T], MWSClientCsRuntime.IMwsObject)
Here is the Code I'm running
MarketplaceWebServiceProducts.MarketplaceWebServiceProducts service = new MarketplaceWebServiceProductsClient (config.MWS_AccessKeyId, config.MWS_secretKey);
SellerSKUListType list = new SellerSKUListType ();
List<String> SKUList = new List<String> ();
SKUList.Add (SKU);
list.SellerSKU = SKUList;
GetCompetitivePricingForSKURequest request = new GetCompetitivePricingForSKURequest ();
request.MarketplaceId = config.MWS_MarketPlaceId;
request.SellerId = config.MWS_SellerId;
request.SellerSKUList = list;
GetCompetitivePricingForSKUResponse response = service.GetCompetitivePricingForSKU (request);
Have you tried to specify application name and application version?
var config = new MarketplaceWebServiceProductsConfig();
config.ServiceURL = "https://mws.amazonservices.com/Products/2011-10-01";
config.SetUserAgent(ApplicationName, ApplicationVersion);
var service = new MarketplaceWebServiceProductsClient(ApplicationName, ApplicationVersion, MWSaccessKey, MWSsecretKey, config);