I am using calendar plugin to fetch all the events from iOS native calendar.
https://github.com/EddyVerbruggen/Calendar-PhoneGap-Plugin
I am trying to use the below method for that.
var calendarName = "iCal";
window.plugins.calendar.findAllEventsInNamedCalendar(calendarName,success,error);
When I am running the application, and trying to fetch all the events, it is showing the below error.
"Error: could not find calendar."
$("#create").click(function(){
window.plugins.calendar.createEvent(title,location1,notes,startDate,endDate,success,error);
});
$("#find").click(function(){
window.plugins.calendar.findEvent(title,location1,notes,startDate,endDate,success,error);
});
$("#deleteAll").click(function(){
window.plugins.calendar.deleteEvent(title,location1,notes,startDate,endDate,success,error);
});
Create events, find events and Delete is working.
Can any one help to find out what should be the value of "calendarName" variable to find the value from iOS native database ?
you are just running full code which is given to github right
first you have to create calendar then you can find it. in below sequence once calendar is created then in second it will be deleted too.
// prep some variables
var startDate = new Date("September 24, 2013 13:00:00");
var endDate = new Date("September 24, 2013 14:30:00");
var title = "My nice event";
var location = "Home";
var notes = "Some notes about this event.";
var success = function(message) { alert("Success: " + JSON.stringify(message)); };
var error = function(message) { alert("Error: " + message); };
var calendarName = "iCal";
// create a calendar (iOS only for now)
window.plugins.calendar.createCalendar(calendarName,success,error);
// create in a named calendar (iOS only for now)
window.plugins.calendar.createEventInNamedCalendar(title,location,notes,startDate,endDate,calendarName,success,error);
Now you can check below events
// find (iOS only for now)
window.plugins.calendar.findEvent(title,location,notes,startDate,endDate,success,error);
// find all events in a named calendar (iOS only for now)
window.plugins.calendar.findAllEventsInNamedCalendar(calendarName,success,error);
the PhoneGap 2.x version does not support the named calendar. Maybe you are using the 2.x version of the plugin with the 3.x readme?
Please refer to the 2.x readme: https://github.com/EddyVerbruggen/Calendar-PhoneGap-Plugin/tree/pre-3.0
Related
8/3/2022 13:40:32 NotImplementedError: This is not implemented yet. For currently supported API, see: https://developers.google.com/google-ads/scripts-beta/docs/reference/adsapp/adsapp
at Ha (adsapp_compiled:298:11)
at new $y (adsapp_compiled:13027:5)
at qC.newVideoAd (adsapp_compiled:15250:12)
at Object.<anonymous> (adsapp_compiled:18396:54)
var youtubeVideoId = "youtubeVideoId";
var adGroupName = "adGroupName" // name of my target video ad group
var displayUrl = "display-url.com";
var finalUrl = "https://final-url.com";
var assetOperation = AdsApp.adAssets().newYouTubeVideoAssetBuilder()
.withName(adName)
.withYouTubeVideoId(youtubeVideoId)
.build();
var videoAsset = assetOperation.getResult();
var videoAdGroup = AdsApp.videoAdGroups()
.withCondition(`Name = '${adGroupName}'`)
.withLimit(1)
.get()
.next();
var videoAdOperation = videoAdGroup.newVideoAd().inStreamAdBuilder()
.withVideo(videoAsset)
.withAdName(adName)
.withDisplayUrl(displayUrl)
.withFinalUrl(finalUrl)
.build()
.getResult();
// Code crash before next statement
if(videoAdOperation.isSuccessful()) {
var videoAd = videoAdOperation.getResult();
Logger.log("VideoAd " + videoAd.getName() + " created.");
} else {
Logger.log(videoAdOperation.getErrors());
}
Code breaks after videoAdGroup.newVideoAd().inStreamAdBuilder().
Following the google ads script docs everything should works nice.
But when I compile the script, I always get the next error:
I have just found in a Google ads scripts forum somebody who has the same problem here but no solution.
The problem is that beta mode which is active by default. Must be switched off for this action.
As a negative point, switch off Beta mode will not allow you to use javascript arrow functions, neither js classes.
I am writing a calendar integration and using the Google Calendar api and Outlook Graph api to sync calendar events. I am receiving webhook notifications as changes are made to events, so I need a way to identify that an event in Google and an event in Outlook are the same (or different) events. Theoretically, this should be done with the iCalUId.
However, when I create an event in Google that has an Outlook attendee, the event created in Outlook does not have the same iCalUId as the event in Google.
I created a work-around for this by reading the iCalUId from the attachment sent by Google to Outlook. However, the Outlook event itself still has a different iCalUId than the Google event, which makes it difficult to process future updates.
Conceptually, Outlook is able to update an event (and show it updated on the calendar) when it is updated by Google. So Outlook must be storing some reference to the Google event.
Does anyone know what that reference is and if it is accessible through the Graph API/SDK?
UPDATE
Here is the code I am using to save an event in Google using the Google API/SDK:
var service = await GoogleAuthenticationProvider.GetCalendarService(CALENDAR_CLIENT_ID, CALENDAR_CLIENT_SECRET, CALENDAR_ACCESS_SCOPES, Person.CalendarRefreshToken).ConfigureAwait(false);
var timeZoneInfo = TimeZoneInfo.FindSystemTimeZoneById(Person.TimeZone);
//in google, having the organizer as an attendee causes the organizer to receive notification emails from google- which we don't want, so remove him/her from the attendees
var attendees = Event.Attendees.Where(a => a.Value != Event.OrganizerEmail);
var tmpEvent = new Google.Apis.Calendar.v3.Data.Event
{
Id = ExternalID.IsNullOrEmptyExtension() ? Convert.ToString(Event.ID) : ExternalID,
Start = new EventDateTime
{
DateTime = Event.StartDate,
TimeZone = GetGoogleTimeZoneFromSystemTimeZone(timeZoneInfo.Id)
},
End = new EventDateTime
{
DateTime = Event.EndDate,
TimeZone = GetGoogleTimeZoneFromSystemTimeZone(timeZoneInfo.Id)
},
Summary = Event.Title,
Description = Event.Description,
Attendees = attendees.Select(a => new EventAttendee
{
Email = a.Value,
ResponseStatus = "accepted"
}).ToList(),
GuestsCanInviteOthers = false,
Location = Event.Location,
Recurrence = Event.RecurrenceRule.IsNullOrEmptyExtension() ? new List<string> { } : new List<string> { "RRULE:" + Event.RecurrenceRule }
};
var savedEvent = new Google.Apis.Calendar.v3.Data.Event { };
if (ExternalID.IsNullOrEmptyExtension())
{
EventsResource.InsertRequest insertRequest = service.Events.Insert(tmpEvent, GOOGLE_PRIMARY_CALENDARID);
insertRequest.SendUpdates = EventsResource.InsertRequest.SendUpdatesEnum.All;
savedEvent = await insertRequest.ExecuteAsync().ConfigureAwait(false);
}
else
{
var updateRequest = service.Events.Update(tmpEvent, GOOGLE_PRIMARY_CALENDARID, ExternalID);
updateRequest.SendUpdates = EventsResource.UpdateRequest.SendUpdatesEnum.All;
savedEvent = await updateRequest.ExecuteAsync().ConfigureAwait(false);
}
I am using TempHire Angular 2 as the reference architecture in my current project. I am facing very same issue as in the following Stackoverflow thread i.e unable to save date value in SQL server as input by the user due to UTC issue.
breezejs: date is not set to the right time
In my Angular2/Typescript project, where I can do the changes as described in the above URL. Typescript syntax is appreciated.
Note: I have already included momentJs in my project.
Please refer.
https://github.com/Breeze/temphire.angular/issues/12
if anyone has similar requirements, I have done the below.
Inside prepare()
{
.........
.........
DataType.parseDateFromServer = this.parseDateAsMoment;
.........
.........
}
parseDateAsMoment(source: any): Date{
var date = moment.utc(source, 'YYYY-MM-DD HH-mm-ss');
return date.toDate();
}
In Angular component, ondatechanged event of MyDatePicker.
onDateFromChanged(event: IMyDateModel) {
if (event.formatted !== '') {
var newDate = moment.utc(new Date(event.jsdate).toLocaleDateString()).format('YYYY-MM-DD HH-mm-ss')
var newDate2 = moment.utc(newDate, 'YYYY-MM-DD HH-mm-ss');
this.model.dateFrom = newDate2.toDate();
}
}
Only then the date input stores correctly in SQL Server datetime column.
I am trying to remove older duplicate form responses based on a column using the following code.
The credit for the code goes to: http://www.jacorre.com/tutorial/remove-duplicate-rows-google-spreadsheets/
The code in my script is:
function removeDuplicates() {
var ss = SpreadsheetApp.getActiveSpreadsheet(),
responses = ss.getSheetByName('Name of Source Sheet'),
range = responses.getDataRange(),
numRows = range.getNumRows()-1,
data = range.getValues(),
columnHeadings = [data[0]],
newData = [];
for (var i=numRows; i>0; i--) {
var row = data[i],
duplicate = false;
for (var j in newData) {
if (row[4] == newData[j][4]) {
duplicate = true;
// [4] is the column number from the 1st column. the above would be 1 + 4 = 5th column
}
}
if (!duplicate) {
newData.push(row);
}
}
var final = ss.getSheetByName('Name of Destination Sheet');
if (!final) {
var final = ss.insertSheet('Name of Destination Sheet');
}
final.clearContents();
final.getRange(1,1,1,columnHeadings[0].length).setFontWeight('bold').setValues(columnHeadings);
final.getRange(2, 1, newData.length, newData[0].length).setValues(newData);
}
This has been set to trigger on Form Submit. It works well on new form submissions.
However, when an existing response is edited using 'Form Edit URL' from: https://webapps.stackexchange.com/questions/89551/show-url-used-to-edit-responses-from-a-google-form-in-a-google-spreadsheet-by-us/89566 the values are not updated into the new sheet.
But if the function is run manually the updated row is updated to the new sheet.
How can I sort this problem? Any help will be appreciated. Thank you.
From my own answer posted at Web Applications SE.
I just did a test and found that the on form submit event it's not
being triggered when a response is edited.
I'm not sure if the on form submit trigger is working as intended, if
the above is due to a bug or to a glitch. To be sure, post an issue to
the Google Apps Script Issue
Tracker.
As a workaround, instead of using the on form submit event, use
another way to run your script, like a time-drive trigger.
References
Custom menus in Google Apps - Google Apps Script Guides
Simple or installable triggers - Google Apps Script Guides
Google Apps Script Support
Is there a way to download specific TFS build log? we’re using TFS 2013.
I’ve already tried to use the IBuildDetail, yet failed.
THX.
You can use the menthod “Get Build”. It returns IBuildDetail , use IBuildDetail.LogLocation property to get the log file for this build. Finally download or query it. Below is a demo code:
publicstaticvoid GetBuildLogAndReadThroughTheLog()
{
// Get all the team projects using the TFS API
var tfs = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(ConfigurationManager.AppSettings["TfsUri"]));
var versionControlService = tfs.GetService<VersionControlServer>();
var teamProject = versionControlService.GetAllTeamProjects(false)[0];
// Use the build service to get build details for a team project
var buildService = tfs.GetService<IBuildServer>();
// Get the build details
var build = buildService.QueryBuilds(teamProject.Name)[0];
// Get the location of the build Log
var buildLogLocation = build.LogLocation;
// Get the log file
var logFile = versionControlService.GetItem(buildLogLocation);
// Do you want to download the file to a local path?
TextReader tr = new StreamReader(logFile.DownloadFile());
string input = null;
while ((input = tr.ReadLine()) != null)
{
}
}
}
The entire build log can be found in the Tfs_YourTeamProjectCollection database in the Tbl_BuildInformation. You can also query and get it from DataBase
More ways for you reference: https://paulselles.wordpress.com/2013/11/15/tfs-build-log-querying-build-log-data/
UPdate
Using "StreamReader" will read the log file line by line.
using (StreamReader sr = new StreamReader(buildLogLocation)
{
while (sr.Peek() >= 0)
{
// do your work here...
}
}