public static void SyncDocumentWithOnenote(Document document) { SyncForm syncForm = new SyncForm(); syncForm.Show(); try { //todo: don't know what filter is used for IEnumerator enumerator = document.Range(MmRange.mmRangeAllTopics, false).GetEnumerator(); while (enumerator.MoveNext()) { var topic = enumerator.Current as Topic; if (topic.HasHyperlink) { SyncTopicWithOnenote(topic, ref syncForm); /*topic.Hyperlinks.AsEnumerable() * .ToList() * .ForEach(x => sb.AppendLine("topic.text " + topic.Text + "-----link: " + x.Address));*/ } } } catch (Exception ex) { throw new OneMapException("Error syncing document", ex); } finally { syncForm.Close(); syncForm.Dispose(); } }
private void SyncTopicLinksWithOnnote() { if (OnenoteUtils.WSearchIsOn()) { var seltopic = _MindManager.ActiveDocument.Selection.PrimaryTopic; SyncForm syncForm = new SyncForm(); try { Utils.SyncTopicWithOnenote(seltopic, ref syncForm); } catch (Exception ex) { throw new OneMapException("SyncDocumentWithOneNote-> couldn't synchronize document with onenote", ex); } finally { syncForm.Close(); } } else { MessageBox.Show("WSearch is not on!!!!"); } }