2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 using System.Collections.Generic;
19 using System.Runtime.InteropServices;
20 using System.Diagnostics.CodeAnalysis;
22 namespace Tizen.Pims.Calendar
25 /// CalendarDatabase provides methods to manage calendar information from/to the database.
28 /// This class allows user to access/create/update db operations for calendar information.
30 public class CalendarDatabase
32 private Object thisLock = new Object();
33 private Dictionary<string, EventHandler<DBChangedEventArgs>> _eventHandlerMap = new Dictionary<string, EventHandler<DBChangedEventArgs>>();
34 private Dictionary<string, Interop.Database.DBChangedCallback> _callbackMap = new Dictionary<string, Interop.Database.DBChangedCallback>();
35 private Interop.Database.DBChangedCallback _dbChangedDelegate;
37 internal CalendarDatabase()
39 ///To be created in CalendarManager only
43 /// The calendar database version.
45 /// <value>The current calendar database version.</value>
46 [SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")]
52 int error = Interop.Database.GetCurrentVersion(out version);
53 if (CalendarError.None != (CalendarError)error)
55 Log.Error(Globals.LogTag, "Version Failed with error " + error);
62 /// Gets last successful changed calendar database version on the current connection.
64 /// <returns>The last successful changed calendar database version on the current connection</returns>
65 /// <privilege>http://tizen.org/privilege/calendar.read</privilege>
66 /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
67 /// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
68 /// <exception cref="UnauthorizedAccessException">Thrown when application does not have proper privileges</exception>
69 /// <value>The last successful changed calendar database version on the current connection.</value>
70 [SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")]
71 public int LastChangeVersion
76 int error = Interop.Database.GetLastChangeVersion(out version);
77 if (CalendarError.None != (CalendarError)error)
79 Log.Error(Globals.LogTag, "LastChangeVersion Failed with error " + error);
86 /// Inserts a record into the calendar database.
88 /// <param name="record">The record to be inserted</param>
89 /// <returns>The ID of inserted record</returns>
90 /// <privilege>http://tizen.org/privilege/calendar.write</privilege>
91 /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
92 /// <exception cref="NotSupportedException">Thrown when an invoked method is not supported</exception>
93 /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
94 /// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
95 /// <exception cref="UnauthorizedAccessException">Thrown when application does not have proper privileges</exception>
96 [SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")]
97 public int Insert(CalendarRecord record)
100 int error = Interop.Database.Insert(record._recordHandle, out id);
101 if (CalendarError.None != (CalendarError)error)
103 Log.Error(Globals.LogTag, "Insert Failed with error " + error);
104 throw CalendarErrorFactory.GetException(error);
110 /// Gets a record from the calendar database.
112 /// <param name="viewUri">The view URI of a record</param>
113 /// <param name="recordId">The record ID</param>
115 /// The record associated with the record ID
117 /// <privilege>http://tizen.org/privilege/calendar.read</privilege>
118 /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
119 /// <exception cref="NotSupportedException">Thrown when an invoked method is not supported</exception>
120 /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
121 /// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
122 /// <exception cref="UnauthorizedAccessException">Thrown when application does not have proper privileges</exception>
123 [SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")]
124 [SuppressMessage("Microsoft.Design", "CA1054:UriParametersShouldNotBeStrings")]
125 public CalendarRecord Get(string viewUri, int recordId)
128 int error = Interop.Database.Get(viewUri, recordId, out handle);
129 if (CalendarError.None != (CalendarError)error)
131 if (CalendarError.DBNotFound == (CalendarError)error)
133 Log.Error(Globals.LogTag, "No data" + error);
136 Log.Error(Globals.LogTag, "Get Failed with error " + error);
137 throw CalendarErrorFactory.GetException(error);
139 return new CalendarRecord(handle);
143 /// Updates a record in the calendar database.
145 /// <param name="record">The record to be updated</param>
146 /// <privilege>http://tizen.org/privilege/calendar.write</privilege>
147 /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
148 /// <exception cref="NotSupportedException">Thrown when an invoked method is not supported</exception>
149 /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
150 /// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
151 /// <exception cref="UnauthorizedAccessException">Thrown when application does not have proper privileges</exception>
152 [SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")]
153 public void Update(CalendarRecord record)
155 int error = Interop.Database.Update(record._recordHandle);
156 if (CalendarError.None != (CalendarError)error)
158 Log.Error(Globals.LogTag, "Update Failed with error " + error);
159 throw CalendarErrorFactory.GetException(error);
164 /// Deletes a record from the calendar database with related child records.
166 /// <param name="viewUri">The view URI of a record</param>
167 /// <param name="recordId">The record ID to be deleted</param>
168 /// <privilege>http://tizen.org/privilege/calendar.write</privilege>
169 /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
170 /// <exception cref="NotSupportedException">Thrown when an invoked method is not supported</exception>
171 /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
172 /// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
173 /// <exception cref="UnauthorizedAccessException">Thrown when application does not have proper privileges</exception>
174 [SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")]
175 [SuppressMessage("Microsoft.Design", "CA1054:UriParametersShouldNotBeStrings")]
176 public void Delete(string viewUri, int recordId)
178 int error = Interop.Database.Delete(viewUri, recordId);
179 if (CalendarError.None != (CalendarError)error)
181 Log.Error(Globals.LogTag, "Delete Failed with error " + error);
182 throw CalendarErrorFactory.GetException(error);
187 /// Replaces a record in the calendar database.
189 /// <param name="record">The record to be replaced</param>
190 /// <param name="id">the record id</param>
191 /// <privilege>http://tizen.org/privilege/calendar.write</privilege>
192 /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
193 /// <exception cref="NotSupportedException">Thrown when an invoked method is not supported</exception>
194 /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
195 /// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
196 /// <exception cref="UnauthorizedAccessException">Thrown when application does not have proper privileges</exception>
197 [SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")]
198 public void Replace(CalendarRecord record, int id)
200 int error = Interop.Database.Replace(record._recordHandle, id);
201 if (CalendarError.None != (CalendarError)error)
203 Log.Error(Globals.LogTag, "Replace Failed with error " + error);
204 throw CalendarErrorFactory.GetException(error);
209 /// Retrieves all records as a list.
211 /// <param name="viewUri">The view URI to get records from</param>
212 /// <param name="offset">The index from which results are received</param>
213 /// <param name="limit">The maximum number of results(value 0 is used for all records)</param>
217 /// <privilege>http://tizen.org/privilege/calendar.read</privilege>
218 /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
219 /// <exception cref="NotSupportedException">Thrown when an invoked method is not supported</exception>
220 /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
221 /// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
222 /// <exception cref="UnauthorizedAccessException">Thrown when application does not have proper privileges</exception>
223 [SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")]
224 [SuppressMessage("Microsoft.Design", "CA1054:UriParametersShouldNotBeStrings")]
225 public CalendarList GetAll(string viewUri, int offset, int limit)
228 int error = Interop.Database.GetAllRecords(viewUri, offset, limit, out handle);
229 if (CalendarError.None != (CalendarError)error)
231 Log.Error(Globals.LogTag, "GetAll Failed with error " + error);
232 throw CalendarErrorFactory.GetException(error);
234 return new CalendarList(handle);
238 /// Retrieves records using a query.
240 /// <param name="query">The query used to filter results</param>
241 /// <param name="offset">The index from which results are received</param>
242 /// <param name="limit">The maximum number of results(value 0 is used for all records)</param>
246 /// <privilege>http://tizen.org/privilege/calendar.read</privilege>
247 /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
248 /// <exception cref="NotSupportedException">Thrown when an invoked method is not supported</exception>
249 /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
250 /// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
251 /// <exception cref="UnauthorizedAccessException">Thrown when application does not have proper privileges</exception>
252 [SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")]
253 public CalendarList GetRecordsWithQuery(CalendarQuery query, int offset, int limit)
256 int error = Interop.Database.GetRecords(query._queryHandle, offset, limit, out handle);
257 if (CalendarError.None != (CalendarError)error)
259 Log.Error(Globals.LogTag, "GetAllWithQuery Failed with error " + error);
260 throw CalendarErrorFactory.GetException(error);
262 return new CalendarList(handle);
266 /// Inserts multiple records into the calendar database as a batch operation.
268 /// <param name="list">The record list</param>
270 /// The inserted record id array
272 /// <privilege>http://tizen.org/privilege/calendar.write</privilege>
273 /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
274 /// <exception cref="NotSupportedException">Thrown when an invoked method is not supported</exception>
275 /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
276 /// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
277 /// <exception cref="UnauthorizedAccessException">Thrown when application does not have proper privileges</exception>
278 [SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")]
279 public int[] Insert(CalendarList list)
283 int error = Interop.Database.InsertRecords(list._listHandle, out ids, out count);
284 if (CalendarError.None != (CalendarError)error)
286 Log.Error(Globals.LogTag, "Insert Failed with error " + error);
287 throw CalendarErrorFactory.GetException(error);
289 int[] idArr = new int[count];
290 Marshal.Copy(ids, idArr, 0, count);
296 /// Updates multiple records into the calendar database as a batch operation.
298 /// <param name="list">The record list</param>
299 /// <privilege>http://tizen.org/privilege/calendar.write</privilege>
300 /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
301 /// <exception cref="NotSupportedException">Thrown when an invoked method is not supported</exception>
302 /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
303 /// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
304 /// <exception cref="UnauthorizedAccessException">Thrown when application does not have proper privileges</exception>
305 [SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")]
306 public void Update(CalendarList list)
308 int error = Interop.Database.UpdateRecords(list._listHandle);
309 if (CalendarError.None != (CalendarError)error)
311 Log.Error(Globals.LogTag, "Update Failed with error " + error);
312 throw CalendarErrorFactory.GetException(error);
317 /// Deletes multiple records with related child records from the calendar database as a batch operation.
319 /// <param name="viewUri">The view URI of the records to delete</param>
320 /// <param name="idArray">The record IDs to delete</param>
321 /// <privilege>http://tizen.org/privilege/calendar.write</privilege>
322 /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
323 /// <exception cref="NotSupportedException">Thrown when an invoked method is not supported</exception>
324 /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
325 /// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
326 /// <exception cref="UnauthorizedAccessException">Thrown when application does not have proper privileges</exception>
327 [SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")]
328 [SuppressMessage("Microsoft.Design", "CA1054:UriParametersShouldNotBeStrings")]
329 public void Delete(string viewUri, int[] idArray)
331 int error = Interop.Database.DeleteRecords(viewUri, idArray, idArray.Length);
332 if (CalendarError.None != (CalendarError)error)
334 Log.Error(Globals.LogTag, "Delete Failed with error " + error);
335 throw CalendarErrorFactory.GetException(error);
340 /// Deletes multiple records with related child records from the calendar database as a batch operation.
342 /// <param name="list">The record list</param>
343 /// <privilege>http://tizen.org/privilege/calendar.write</privilege>
344 /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
345 /// <exception cref="NotSupportedException">Thrown when an invoked method is not supported</exception>
346 /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
347 /// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
348 /// <exception cref="UnauthorizedAccessException">Thrown when application does not have proper privileges</exception>
349 public void Delete(CalendarList list)
351 CalendarRecord record = null;
355 int[] ids = new int[list.Count];
359 for (i = 0; i < list.Count; i++)
361 record = list.GetCurrentRecord();
364 if (0 == String.Compare(CalendarViews.Book.Uri, record.Uri))
365 propertyId = CalendarViews.Book.Id;
366 else if (0 == String.Compare(CalendarViews.Event.Uri, record.Uri))
367 propertyId = CalendarViews.Event.Id;
368 else if (0 == String.Compare(CalendarViews.Todo.Uri, record.Uri))
369 propertyId = CalendarViews.Todo.Id;
370 else if (0 == String.Compare(CalendarViews.Timezone.Uri, record.Uri))
371 propertyId = CalendarViews.Timezone.Id;
372 else if (0 == String.Compare(CalendarViews.Extended.Uri, record.Uri))
373 propertyId = CalendarViews.Extended.Id;
376 Log.Error(Globals.LogTag, "Invalid uri [" + record.Uri + "]");
380 ids[i] = record.Get<int>(propertyId);
383 Delete(record.Uri, ids);
387 /// Replaces multiple records in the calendar database as a batch operation.
389 /// <param name="list">The record list</param>
390 /// <param name="idArray">The record IDs</param>
391 /// <privilege>http://tizen.org/privilege/calendar.write</privilege>
392 /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
393 /// <exception cref="NotSupportedException">Thrown when an invoked method is not supported</exception>
394 /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
395 /// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
396 /// <exception cref="UnauthorizedAccessException">Thrown when application does not have proper privileges</exception>
397 [SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")]
398 public void Replace(CalendarList list, int[] idArray)
400 int error = Interop.Database.ReplaceRecords(list._listHandle, idArray, idArray.Length);
401 if (CalendarError.None != (CalendarError)error)
403 Log.Error(Globals.LogTag, "Replace Failed with error " + error);
404 throw CalendarErrorFactory.GetException(error);
409 /// Retrieves records with the given calendar database version.
411 /// <param name="viewUri">The view URI to get records from</param>
412 /// <param name="BookId">The calendar book ID to filter</param>
413 /// <param name="calendarDBVersion">The calendar database version</param>
414 /// <param name="currentDBVersion">The current calendar database version</param>
418 /// <privilege>http://tizen.org/privilege/calendar.read</privilege>
419 /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
420 /// <exception cref="NotSupportedException">Thrown when an invoked method is not supported</exception>
421 /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
422 /// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
423 /// <exception cref="UnauthorizedAccessException">Thrown when application does not have proper privileges</exception>
424 [SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")]
425 [SuppressMessage("Microsoft.Design", "CA1054:UriParametersShouldNotBeStrings")]
426 public CalendarList GetChangesByVersion(string viewUri, int BookId, int calendarDBVersion, out int currentDBVersion)
429 int error = Interop.Database.GetChangesByVersion(viewUri, BookId, calendarDBVersion, out recordList, out currentDBVersion);
430 if (CalendarError.None != (CalendarError)error)
432 Log.Error(Globals.LogTag, "GetChangesByVersion Failed with error " + error);
433 throw CalendarErrorFactory.GetException(error);
435 return new CalendarList(recordList);
439 /// Gets the record count of a specific view.
441 /// <param name="viewUri">The view URI to get records from</param>
443 /// The count of records
445 /// <privilege>http://tizen.org/privilege/calendar.read</privilege>
446 [SuppressMessage("Microsoft.Design", "CA1822:MarkMembersAsStatic")]
447 [SuppressMessage("Microsoft.Design", "CA1054:UriParametersShouldNotBeStrings")]
448 public int GetCount(string viewUri)
451 int error = Interop.Database.GetCount(viewUri, out count);
452 if (CalendarError.None != (CalendarError)error)
454 Log.Error(Globals.LogTag, "GetCount Failed with error " + error);
455 throw CalendarErrorFactory.GetException(error);
461 /// Gets the record count with a query.
463 /// <param name="query">The query used for filtering the results</param>
465 /// The count of records
467 /// <privilege>http://tizen.org/privilege/calendar.read</privilege>
468 [SuppressMessage("Microsoft.Design", "CA1822:MarkMembersAsStatic")]
469 public int GetCount(CalendarQuery query)
472 int error = Interop.Database.GetCountWithQuery(query._queryHandle, out count);
473 if (CalendarError.None != (CalendarError)error)
475 Log.Error(Globals.LogTag, "GetCount Failed with error " + error);
476 throw CalendarErrorFactory.GetException(error);
482 /// Registers a callback function to be invoked when a record changes.
484 /// <param name="viewUri">The view URI of the record to subscribe for change notifications</param>
485 /// <param name="DBChanged">The EventHandler to register</param>
486 /// <privilege>http://tizen.org/privilege/calendar.read</privilege>
487 [SuppressMessage("Microsoft.Design", "CA1054:UriParametersShouldNotBeStrings")]
488 public void AddDBChangedDelegate(string viewUri, EventHandler<DBChangedEventArgs> DBChanged)
490 Log.Debug(Globals.LogTag, "AddDBChangedDelegate");
492 if (!_callbackMap.ContainsKey(viewUri))
494 _callbackMap[viewUri] = (string uri, IntPtr userData) =>
496 DBChangedEventArgs args = new DBChangedEventArgs(uri);
497 _eventHandlerMap[uri]?.Invoke(this, args);
500 int error = Interop.Database.AddChangedCallback(viewUri, _dbChangedDelegate, IntPtr.Zero);
501 if (CalendarError.None != (CalendarError)error)
503 Log.Error(Globals.LogTag, "AddDBChangedDelegate Failed with error " + error);
504 throw CalendarErrorFactory.GetException(error);
508 EventHandler<DBChangedEventArgs> handler = null;
509 if (!_eventHandlerMap.TryGetValue(viewUri, out handler))
510 _eventHandlerMap.Add(viewUri, null);
512 _eventHandlerMap[viewUri] = handler + DBChanged;
516 /// Deregisters a callback function.
518 /// <param name="viewUri">The view URI of the record to subscribe for change notifications</param>
519 /// <param name="DBChanged">The EventHandler to deregister</param>
520 /// <privilege>http://tizen.org/privilege/calendar.read</privilege>
521 [SuppressMessage("Microsoft.Design", "CA1054:UriParametersShouldNotBeStrings")]
522 public void RemoveDBChangedDelegate(string viewUri, EventHandler<DBChangedEventArgs> DBChanged)
524 Log.Debug(Globals.LogTag, "RemoveDBChangedDelegate");
526 EventHandler<DBChangedEventArgs> handler = null;
527 if (!_eventHandlerMap.TryGetValue(viewUri, out handler))
528 _eventHandlerMap.Add(viewUri, null);
530 _eventHandlerMap[viewUri] = handler - DBChanged;
532 if (_eventHandlerMap[viewUri] == null)
534 int error = Interop.Database.RemoveChangedCallback(viewUri, _callbackMap[viewUri], IntPtr.Zero);
535 if (CalendarError.None != (CalendarError)error)
537 Log.Error(Globals.LogTag, "RemoveDBChangedDelegate Failed with error " + error);
538 throw CalendarErrorFactory.GetException(error);
540 _callbackMap.Remove(viewUri);
545 /// Link a record to another record.
547 /// <param name="baseId">The base record ID</param>
548 /// <param name="recordId">The record ID to link to</param>
549 /// <privilege>http://tizen.org/privilege/calendar.write</privilege>
550 /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
551 /// <exception cref="NotSupportedException">Thrown when an invoked method is not supported</exception>
552 /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
553 /// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
554 /// <exception cref="UnauthorizedAccessException">Thrown when application does not have proper privileges</exception>
555 [SuppressMessage("Microsoft.Design", "CA1822:MarkMembersAsStatic")]
556 public void LinkRecord(int baseId, int recordId)
558 Log.Debug(Globals.LogTag, "LinkRecord");
559 int error = Interop.Database.LinkRecord(baseId, recordId);
560 if (CalendarError.None != (CalendarError)error)
562 Log.Error(Globals.LogTag, "LinkRecor Failed with error " + error);
563 throw CalendarErrorFactory.GetException(error);
568 /// Unlink a record from base record.
570 /// <param name="recordId">The record ID to unlink</param>
571 /// <privilege>http://tizen.org/privilege/calendar.write</privilege>
572 /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
573 /// <exception cref="NotSupportedException">Thrown when an invoked method is not supported</exception>
574 /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
575 /// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
576 /// <exception cref="UnauthorizedAccessException">Thrown when application does not have proper privileges</exception>
577 [SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")]
578 public void UnlinkRecord(int recordId)
580 Log.Debug(Globals.LogTag, "UnlinkRecord");
581 int error = Interop.Database.UnlinkRecord(recordId);
582 if (CalendarError.None != (CalendarError)error)
584 Log.Error(Globals.LogTag, "UnlinkRecor Failed with error " + error);
585 throw CalendarErrorFactory.GetException(error);