/// <summary> /// Creates a new address book folder. /// </summary> /// <param name="context">Instance of <see cref="DavContext"/> class.</param> /// <param name="name">Address book name.</param> /// <param name="description">Address book description.</param> internal static async Task CreateAddressbookFolderAsync(DavContext context, string name, string description) { // 1. Create address book. // 2. Grant owner privileges to the user on the created address book(s). string sql = @"INSERT INTO [card_AddressbookFolder] ( [AddressbookFolderId] , [Name] , [Description] ) VALUES ( @AddressbookFolderId , @Name , @Description ) ; INSERT INTO [card_Access] ( [AddressbookFolderId] , [UserId] , [Owner] , [Read] , [Write] ) VALUES ( @AddressbookFolderId , @UserId , @Owner , @Read , @Write )"; Guid addressbookFolderId = Guid.NewGuid(); await context.ExecuteNonQueryAsync(sql, "@AddressbookFolderId", addressbookFolderId , "@Name", name , "@Description", description , "@UserId", context.UserId , "@Owner", true , "@Read", true , "@Write", true ); }
/// <summary> /// Creates a new calendar folder. /// </summary> /// <param name="context">Instance of <see cref="DavContext"/> class.</param> /// <param name="name">Calendar folder name.</param> public static async Task CreateCalendarFolderAsync(DavContext context, string name, string description) { // 1. Create calendar. // 2. Grant owner privileges to the user on the created calendar. string sql = @"INSERT INTO [cal_CalendarFolder] ( [CalendarFolderId] , [Name] , [Description] ) VALUES ( @CalendarFolderId , @Name , @Description ) ; INSERT INTO [cal_Access] ( [CalendarFolderId] , [UserId] , [Owner] , [Read] , [Write] ) VALUES ( @CalendarFolderId , @UserId , @Owner , @Read , @Write )"; Guid calendarFolderId = Guid.NewGuid(); await context.ExecuteNonQueryAsync(sql, "@CalendarFolderId", calendarFolderId , "@Name", name , "@Description", description , "@UserId", context.UserId , "@Owner", true , "@Read", true , "@Write", true ); }