IBuildDetail.RequestedFor doesn't get populated after calling QueryBuilds() - tfs

I call IBuildServer.QueryBuilds(), and look at the returned IBuildDetails:
TFS2010: They are populated with user aliases.
TFS2012: They are null.
How can I get the user names in TFS2012?
var collection = new TfsTeamProjectCollection(new Uri(_txtCollection.Text));
var buildServer = collection.GetService<IBuildServer>();
var spec = buildServer.CreateBuildDetailSpec(Settings.Default.ProjectName);
spec.QueryOptions = QueryOptions.Definitions;
spec.QueryOrder = BuildQueryOrder.StartTimeDescending;
spec.InformationTypes = null;
return buildServer.QueryBuilds(spec).Builds;

Add batchedrequests:
spec.QueryOptions = QueryOptions.Definitions
| QueryOptions.BatchedRequests; // Tell TFS2012 to populate RequestedFor / RequestedBy

Related

Add include to CloudSearch in CLoudBoost

I'm trying to do the same as
query = new CB.CloudQuery('Class');
query.include('columnName');
But using CloudSearch, SearchQuery or SearchFilter. Is it possible? For example:
var cs = new CB.CloudSearch(Class);
cs.searchFilter = new CB.SearchFilter();
cs.searchQuery = new CB.SearchQuery();
cs.include('columnName');
// or
cs.searchQuery.include('columnName');
Thanks!
It's actually, cs.searchFilter.include('columnName');

Update sequence number mismatch; requested USN = 2, database USN = 3

I am using Filenet 4.5.1 I have a module in my project where we move the contents from a folder to a newly created folder , and then delete them from old folder.
ObjectStore objectStore;
ReferentialContainmentRelationship toRcr = null;
ReferentialContainmentRelationship fromRcr = null;
DocumentSet documentSet;
Iterator documentIterator;
documentSet = fromFolder.get_ContainedDocuments();
documentIterator = documentSet.iterator();
Document document;
while(documentIterator.hasNext())
{
document = (Document) documentIterator.next();
toRcr = toFolder.file(document,AutoUniqueName.AUTO_UNIQUE, document.getClassName(),DefineSecurityParentage.DO_NOT_DEFINE_SECURITY_PARENTAGE);
toRcr.save(RefreshMode.REFRESH);
toFolder.save(RefreshMode.REFRESH);
fromRcr = fromFolder.unfile(document);
fromFolder.save(RefreshMode.REFRESH);
}
But, here toFolder.save(RefreshMode.REFRESH); is not being executed properly and an exception is coming
Exception in FNServices.getOldFileFolderObject() : The object {ADF64C74-F80D-4BD7-8A58-86699C66BFAC} has been modified since it was retrieved. Update sequence number mismatch; requested USN = 2, database USN = 3.
Here , the object refers to the new folder created.
Judging from IBM documentation, I believe you should create your folder first, and then worry about the filing after.
ObjectStore objectStore;
ReferentialContainmentRelationship toRcr = null;
ReferentialContainmentRelationship fromRcr = null;
DocumentSet documentSet;
Iterator documentIterator;
documentSet = fromFolder.get_ContainedDocuments();
documentIterator = documentSet.iterator();
Document document;
toFolder.save(RefreshMode.REFRESH);
fromFolder.save(RefreshMode.REFRESH);
while(documentIterator.hasNext())
{
document = (Document) documentIterator.next();
toRcr = toFolder.file(document,AutoUniqueName.AUTO_UNIQUE, document.getClassName(),DefineSecurityParentage.DO_NOT_DEFINE_SECURITY_PARENTAGE);
toRcr.save(RefreshMode.REFRESH);
fromRcr = fromFolder.unfile(document);
fromRcr.save(RefreshMode.REFRESH);
}
Take a look here: Working with Containment

Set new placement in Group Criterion via API

How can I add new placement (website, for example www.example.com) in AdGroup using AdWords API?
I have found
AdGroupCriterionService->mutate,
but I need to know ID of website
$adGroupCriterion->criterion = new Criterion($criterionId);
So my question:
How I can found ID for any website or exist another way to add new Placement in AdGroup?
I found an answer:
$adGroupService = $user->GetService('AdGroupCriterionService', 'v201509');
$AdGroupCriterionOperation = new AdGroupCriterionOperation();
$AdGroupCriterionOperation->operator = 'ADD';
$AdGroupCriterion = new BiddableAdGroupCriterion();
$AdGroupCriterion->adGroupId = $adGroupId;
$AdGroupCriterion->criterionUse = 'BIDDABLE';
$AdGroupCriterion->AdGroupCriterionType = 'PLACEMENT';
$Placement = new Placement();
$Placement->id = null;
$Placement->CriterionType = 'PLACEMENT';
$Placement->type = 'PLACEMENT';
$Placement->url = $url;
$AdGroupCriterion->criterion = $Placement;
$AdGroupCriterionOperation->operand = $AdGroupCriterion;
$operations = array($AdGroupCriterionOperation);
// Make the mutate request.
$result = $adGroupService->mutate($operations);

PetaPoco and output parameters from stored procedures?

I'm trying to setup an output parameter using PetaPoco. I found someone using this sample online:
var ctx = new CustomDBDatabase();
var total = new SqlParameter("Total", System.Data.SqlDbType.Int);
total.Direction = System.Data.ParameterDirection.Output;
var results = ctx.Query<DBEntity>("exec GetDBEntities #StartIndex, #MaxIndex, #TotalCount = #Total out",
id, start, max, total);
int totalCount = (int)total.Value;
However, total.value returns null, even though when I run this statement directly against SQL Server, it returns me 3. Is this setup correctly with PetaPoco? Are output parameters supported?
Thanks.
This is supported. But your current syntax is wrong anyways.
var ctx = new CustomDBDatabase();
var total = new SqlParameter("TotalCount", System.Data.SqlDbType.Int);
total.Direction = System.Data.ParameterDirection.Output;
var results = ctx.Query<DBEntity>("exec GetDBEntities #StartIndex, #MaxIndex, #TotalCount OUTPUT", new { StartIndex = start, MaxIndex = max, TotalCount = total});
int totalCount = (int)total.Value;
Something like this should work though. Not quite sure of the sql syntax but this should get you on your way.

FedEx Webservice for printing Multiple shipping labels

I am trying to connect to the FedEx shipping webservice v8.
Everything works fine when I only have one RequestedPackageLineItems set. When I add two items I get the following error.
"Invalid package count or invalid package sequence number."
My Code is as follows
ProcessShipmentRequest request = CreatePendingShipmentRequest();
ShipService service = new ShipService();
ProcessShipmentReply reply = service.processShipment(request);
...
private static ProcessShipmentRequest CreatePendingShipmentRequest()
{
ProcessShipmentRequest request = new ProcessShipmentRequest();
request.WebAuthenticationDetail = new WebAuthenticationDetail();
request.WebAuthenticationDetail.UserCredential = new WebAuthenticationCredential();
request.WebAuthenticationDetail.UserCredential.Key = "XXX";
request.WebAuthenticationDetail.UserCredential.Password = "XXX";
request.ClientDetail = new ClientDetail();
request.ClientDetail.AccountNumber = "XXX";
request.ClientDetail.MeterNumber = "XXX";
request.TransactionDetail = new TransactionDetail();
request.TransactionDetail.CustomerTransactionId = "*** Ground Domestic Shipping Request v8 using C# ***";
request.Version = new VersionId();
//Inside this method I set request.RequestedShipment.PackageCount = "2";
SetShipmentDetails(request);
SetPackageLineItems(request);
return request;
}
private static void SetPackageLineItems(ProcessShipmentRequest request)
{
request.RequestedShipment.RequestedPackageLineItems = new RequestedPackageLineItem[2];
request.RequestedShipment.RequestedPackageLineItems[0] = new RequestedPackageLineItem();
request.RequestedShipment.RequestedPackageLineItems[0].SequenceNumber = "1";
request.RequestedShipment.RequestedPackageLineItems[0].Weight = new Weight();
request.RequestedShipment.RequestedPackageLineItems[0].Weight.Value = 50.0M;
request.RequestedShipment.RequestedPackageLineItems[0].Weight.Units = WeightUnits.LB;
request.RequestedShipment.RequestedPackageLineItems[0].ItemDescription = "Item";
request.RequestedShipment.RequestedPackageLineItems[0].Dimensions = new Dimensions();
request.RequestedShipment.RequestedPackageLineItems[0].Dimensions.Length = "108";
request.RequestedShipment.RequestedPackageLineItems[0].Dimensions.Width = "5";
request.RequestedShipment.RequestedPackageLineItems[0].Dimensions.Height = "5";
request.RequestedShipment.RequestedPackageLineItems[0].Dimensions.Units = LinearUnits.IN;
request.RequestedShipment.RequestedPackageLineItems[0].CustomerReferences = new CustomerReference[3];
request.RequestedShipment.RequestedPackageLineItems[0].CustomerReferences[0] = new CustomerReference();
request.RequestedShipment.RequestedPackageLineItems[0].CustomerReferences[0].CustomerReferenceType = CustomerReferenceType.CUSTOMER_REFERENCE;
request.RequestedShipment.RequestedPackageLineItems[0].CustomerReferences[0].Value = "[LOT NUMBER]";
request.RequestedShipment.RequestedPackageLineItems[0].CustomerReferences[1] = new CustomerReference();
request.RequestedShipment.RequestedPackageLineItems[0].CustomerReferences[1].CustomerReferenceType = CustomerReferenceType.INVOICE_NUMBER;
request.RequestedShipment.RequestedPackageLineItems[0].CustomerReferences[1].Value = "45646";
request.RequestedShipment.RequestedPackageLineItems[0].CustomerReferences[2] = new CustomerReference();
request.RequestedShipment.RequestedPackageLineItems[0].CustomerReferences[2].CustomerReferenceType = CustomerReferenceType.P_O_NUMBER;
request.RequestedShipment.RequestedPackageLineItems[0].CustomerReferences[2].Value = "456446";
request.RequestedShipment.RequestedPackageLineItems[1] = new RequestedPackageLineItem();
request.RequestedShipment.RequestedPackageLineItems[1].SequenceNumber = "2";
request.RequestedShipment.RequestedPackageLineItems[1].Weight = new Weight();
request.RequestedShipment.RequestedPackageLineItems[1].Weight.Value = 50.0M;
request.RequestedShipment.RequestedPackageLineItems[1].Weight.Units = WeightUnits.LB;
request.RequestedShipment.RequestedPackageLineItems[1].ItemDescription = "Item";
....
}
Found out how to do this.
In order to get multiple shipping labels into one pdf the process is as follows.
Create a request
Fill in the shipping info
Post and get a reply.
Save that replay and the byte array and MasterShippingID
Create a new request and assign the master shipping id to it.
Added shipping weight and dimensions
Post and get reply
Save byte array with the other
Continue until all shipments are generated (max 200 per master shipping id)
Merge all the pdfs returned from FedEx into one pdf.
Do a happy dance.
A simpler approach, (though there is a cost) is the Shiprush SDK. It lets you build a single XML block and let ShipRush do all the funny stuff with fedex (or whoever).
They also support their tool.

Resources