How can I get a response after I make a new appointment? An OK response or Not OK and the reason for it..?
After the authentication this is my code for creating the appointment
DateTime bookingStart = new DateTime(2017, 6, 14, 14, 0, 0);
DateTime bookingEnd = bookingStart.AddHours(2);
Booking booking = new Booking()
{
Subject = "BookingTest",
Start = bookingStart,
End = bookingEnd,
Room = "xxx.room#dummy.be",
Person = "person#dummy.be"
};
//Meetingrequest aanmaken
var request = new Appointment(service)
{
Subject = booking.Subject,
Start = booking.Start,
End = booking.End,
Location = booking.Room
};
//Aanhangen wie wilt meedoen
request.RequiredAttendees.Add(booking.Person);
request.RequiredAttendees.Add(booking.Room);
ServiceResponse response = service.CreateItems()
request.Save(SendInvitationsMode.SendOnlyToAll);
But this doesn't give me an object back.
After you save this appointment, the meeting item will get a unique identifier.
request.Save(SendInvitationsMode.SendOnlyToAll);
var id = request.Id.UniqueId;
Save the identifier, later on, you can use this identifier to track the meeting response like this
Appointment meeting = Appointment.Bind(service, new ItemId(id));
for (int i = 0; i < meeting.RequiredAttendees.Count; i++)
{
Console.WriteLine("Required attendee - " + meeting.RequiredAttendees[i].Address + ": " + meeting.RequiredAttendees[i].ResponseType.Value.ToString());
}
Reference: Tracking meeting responses by using the EWS Managed API 2.0
Related
I'm trying to create a report showing daily conversions from the last 30 days with google analytics data api. This is using the dotnet client library Google.Analytics.Data.V1Beta.
However I'm only getting back about 5 conversion values, the last value seems to be reflecting total conversions of all time, ideally I'd like a running update of how many conversions per day so I can plot it to a line chart.
I'm planning to change this to weekly over the course of the past X months once I have the previous issue sorted out.
I'm essentially trying to recreate the chart on the google analytics dashboard:
What am I missing?
public async Task<RunReportResponse> RunReport(string propertyId = "xxxx")
{
BetaAnalyticsDataClient client = BetaAnalyticsDataClient.Create();
FilterExpression hostnameFilter = new();
hostnameFilter.Filter = new();
hostnameFilter.Filter.InListFilter = new();
hostnameFilter.Filter.InListFilter.Values.Add("xxxx");
hostnameFilter.Filter.FieldName = "hostName";
CohortSpec cohort = new();
cohort.Cohorts.Add(new Cohort
{
Dimension = "firstSessionDate",
DateRange = new DateRange()
{
StartDate = DateTime.Now.AddDays(-30).ToString("yyyy-MM-dd"),
EndDate = DateTime.Now.ToString("yyyy-MM-dd")
},
});
cohort.CohortsRange = new CohortsRange
{
EndOffset = 5,
Granularity = CohortsRange.Types.Granularity.Daily
};
// Initialize request argument(s)
RunReportRequest request = new()
{
Property = "properties/" + propertyId,
Dimensions = {new Dimension { Name = "cohort" }, new Dimension { Name = "cohortNthDay" } },
Metrics = { new Metric { Name = "conversions" }, },
DimensionFilter = hostnameFilter,
CohortSpec = cohort,
};
// Make the request
var response = await client.RunReportAsync(request);
return response;
}
}
After upgrading to the latest version of Stripe.Net.
I'm trying to create a new custom connect account, which includes a bank account, with the .Net API and Stripe is throwing this exception.
This account can only be updated with an account token, because it was originally created with an account token. (Attempted to update param 'account_token' directly.)
I'm assigning the AccountToken I'm generating from Stripe.js and that seems to be generating ok. Additionally I have no issue adding an external bank to a already created connect account. I just can't seem to create a new custom account
Here is my c# code
AccountDobOptions dobOptions = new AccountDobOptions()
{
Day = yogaProfile.Birthdate.Day,
Month = yogaProfile.Birthdate.Month,
Year = yogaProfile.Birthdate.Year
};
AddressOptions addressOptions = new AddressOptions()
{
City = bankDetails.City,
Country = bankDetails.CountryCode,
State = bankDetails.CountryCode == "US" ? bankDetails.USStateCode : bankDetails.NonUSStateCode,
PostalCode = bankDetails.PostalCode,
Line1 = bankDetails.AddressLine1,
Line2 = bankDetails.AddressLine2
};
AccountLegalEntityOptions legal = new AccountLegalEntityOptions();
legal.Dob = dobOptions;
legal.Type = "individual";
legal.Address = addressOptions;
legal.FirstName = accountFullName.Split(' ')[0];
legal.LastName = accountFullName.Split(' ')[1];
//legal.SSNLast4 = bankDetails.LastFourSSN;
AccountTosAcceptanceOptions tosOptions = new AccountTosAcceptanceOptions()
{
Date = DateTime.UtcNow,
Ip = clientIpAddress != null ? clientIpAddress : GetUserIpAddress()
};
var accountOptions = new AccountCreateOptions()
{
Email = yogaProfile.ApplicationUser.Email,
Type = AccountType.Custom,
Country = bankDetails.CountryCode,
LegalEntity = legal,
TosAcceptance = tosOptions,
AccountToken = stripeToken,
//TransferScheduleInterval = "weekly",
ExternalBankAccount = new AccountBankAccountOptions()
};
var accountService = new AccountService();
Account account = accountService.Create(accountOptions);
This is my code for sending email.
private void SendEmail(Guid accountToGuid)
{
string name = GetName(service, accountToGuid);
#region Email
Entity fromParty = new Entity("activityparty");
fromParty["partyid"] = new EntityReference("systemuser", ownerId);
Entity toParty = new Entity("activityparty");
toParty["partyid"] = new EntityReference("account", accountToGuid);
Entity Email = new Entity("email");
Email.Attributes["from"] = new Entity[] { fromParty };
Email.Attributes["to"] = new Entity[] { toParty };
Email.Attributes["subject"] = "Hello " + name;
Email.Attributes["description"] = "Your account has been confirmed by Admin";
Email.Attributes["ownerid"] = new EntityReference("systemuser", ownerId);
Guid EmailId = service.Create(Email);
SendEmailRequest req = new SendEmailRequest();
req.EmailId = EmailId;
req.IssueSend = true;
req.TrackingToken = "";
SendEmailResponse res = (SendEmailResponse)service.Execute(req);
#endregion
}
Lets say, I already sent an email to account. Email will display in activities section. How to retrieve it from SDK?
You need to perform either:
(Full examples in links)
Retrieve - When you already know the record Id, email Id in your case.
RetrieveMultiple - When you don't know the record Id, but you are going to search based on some other criteria, e.g. emails related to the account Id.
I am trying to Create a billing agreement with payment method:credit card.
Here is my code:
public void CreateBillingAgreement()
{
var config = ConfigManager.Instance.GetProperties();
var accessToken = new OAuthTokenCredential(config).GetAccessToken();
var apiContext = new APIContext(accessToken);
//Note: Billing agreements for credit card payments execute automatically when created. There is no need for the user to approve the agreement or to execute the agreement.
var credit_card = new CreditCard()
{
billing_address = new Address()
{
city = "Johnstown",
country_code = "US",
line1 = "52 N Main ST",
postal_code = "43210",
state = "OH"
},
cvv2 = "874",
first_name = "Test",
last_name = "abc",
expire_month = **,
expire_year = ****,
number = "********",
type = "visa"
};
List<FundingInstrument> funding_instruments = new List<FundingInstrument>();
var fund = new FundingInstrument
{
credit_card = credit_card
};
funding_instruments.Add(fund);
var payer = new Payer
{
payment_method = "credit_card",
funding_instruments = funding_instruments
};
var shipping_address = new ShippingAddress
{
line1 = "1234",
city = "California",
state = "California",
postal_code = "95070",
country_code = "US"
};
string Date = DateTime.Now.ToString("yyyy-MM-ddTHH:MM:ssZ");
//Make API call
var agreement = new Agreement
{
name = "T-Shirt of the Month Club Agreement",
description = "Agreement for T-Shirt of the Month Club Plan",
start_date = Date,
plan = new Plan
{
id = "P-*****************"
},
payer = payer,
shipping_address = shipping_address
};
var CreateExecuteAgreement = agreement.Create(apiContext);
But getting this error,
//{"name":"DPRP_DISABLED","message":"DPRP is disabled for this
merchant.","information_link":"https://developer.paypal.com/webapps/developer/docs/api/#DPRP_DISABLED","debug_id":"********"}
}
DPRP = DirectPayment Recurring Payments. This is very specific.
To use this you would need to be using "PayPal Website Payments Pro 3.0", where you would typically use the DoDirectPayment API to process credit cards, and that is $30/mo.
On top of that, you need to add Recurring Payments, and then you would use the CreateRecurringPaymentsProfile API with credit card details included directly (which must be what this SDK you're using is doing). This is considered DPRP, and this is an additional $30/mo on top of the fee for Pro.
Many people get confused because if you sign up for "Payments Pro Recurring Billing" they will probably put you into the PayFlow version, in which case you would need to use the PayFlow API instead of DoDirectPayment / CreateRecurringPaymentsProfile.
So the first thing you need to do is very which version of Payments Pro you are using, and then verify whether or not you have Recurring Payments / Billing enabled on top of that.
Here is my current code:
Service = new CalendarService("googleid.apps.googleusercontent.com");
Service.setUserCredentials("calenderusername#gmail.com", "passwordforaccount");
var calendarquery = new EventQuery
{
Uri =new Uri("https://www.google.com/calendar/feeds/calenderusername#gmail.com/private/full"),
StartTime = DateTime.Now,
NumberToRetrieve = 1,
SortOrder = CalendarSortOrder.#ascending
};
var feedItem = Service.Query(calendarquery).Entries.FirstOrDefault() as EventEntry;
var times = new Google.GData.Extensions.When();
times = feedItem.Times[0];
var item = new CalendarEvent
{
Description = feedItem.Content.Content,
EventDateStart = times.StartTime,
Title = feedItem.Title.Text,
EventDateEnd = times.EndTime,
URL = feedItem.Links.FirstOrDefault().HRef.Content
};
However, i get the item listed out:
EventStartDate: {10.02.2014 11:00:00}
EventEndDate: {10.02.2014 23:30:00}
But i know there is an event today(07.02.2014). Anyone have any idea what im doing wrong?
I'm confused wether to use startDate or startTime in my calendarQuery.