private void DisplayList(SharePointList childList, TreeNodeCollection treeNodeCollection) { TreeNode listnode = new TreeNode(childList.Title); listnode.Tag = childList; listnode.ImageKey = "SPList"; listnode.SelectedImageKey = "SPList"; treeNodeCollection.Add(listnode); foreach(SharePointItem childItem in childList.ChildItems) { DisplayItem(childItem, listnode.Nodes); } }
//========================================================= CreationDesListDuWebPart() =========================================================== public void CreationDesListDuWebPart(SPListCollection lists) { champSPlist champ; //===============creation de la liste 1====================== try { champ = new champSPlist(champ1); listSP = new SharePointList(list1, "", SPListTemplateType.GenericList); // creation de l'objet champ.addCollInfo("Antenne Judiciaire Antibes"); champ.addCollInfo("Centre Technique Vallauris"); champ.addCollInfo("Envibus (St-Bernard)"); champ.addCollInfo("Gare routiere Antibes"); champ.addCollInfo("Gare routiere Vallauris"); champ.addCollInfo("Gare routiere Valbonne"); champ.addCollInfo("Les Genets"); champ.addCollInfo("Logements (Liberation)"); champ.addCollInfo("Mediatheque Antibes"); champ.addCollInfo("Mediatheque Semboules"); champ.addCollInfo("Mediatheque Valbonne"); champ.addCollInfo("Mediatheque Roquefort"); champ.addCollInfo("Parenthese"); champ.addCollInfo("Prevention Antibes"); champ.addCollInfo("Prevention Vallauris"); champ.addCollInfo("Prevention Valbonne"); champ.addCollInfo("Prevention Haut Pays"); champ.addCollInfo("Trait d union"); champ.addCollInfo("indeterminée"); listSP.addCollChamps(champ); // remplissage de la collection de champs a creer listSP.creerListInSharePoint(lists); } catch { } //===============creation de la liste 2====================== try { champ = new champSPlist(champ2); listSP = new SharePointList(list2, "", SPListTemplateType.GenericList); champ.addCollInfo("Stagiaire"); champ.addCollInfo("Contrat"); champ.addCollInfo("Titulaire"); champ.addCollInfo("indeterminée"); listSP.addCollChamps(champ); listSP.creerListInSharePoint(lists); } catch { } //===============creation de la liste 3====================== try { champ = new champSPlist(champ3); listSP = new SharePointList(list3, "", SPListTemplateType.GenericList); champ.addCollInfo("Lundi"); champ.addCollInfo("Mardi"); champ.addCollInfo("Mercredi"); champ.addCollInfo("Jeudi"); champ.addCollInfo("Vendredi"); champ.addCollInfo("Samedi"); champ.addCollInfo("Dimanche"); listSP.addCollChamps(champ); listSP.creerListInSharePoint(lists); } catch { } //===============creation de la liste 4====================== try { champ = new champSPlist(champ4); listSP = new SharePointList(list4, "", SPListTemplateType.GenericList); champ.addCollInfo("Fixes CASA uniquement"); champ.addCollInfo("Fixes et portables CASA uniquement"); champ.addCollInfo("Libre"); listSP.addCollChamps(champ); listSP.creerListInSharePoint(lists); } catch { } //===============creation de la liste 5====================== try { champ = new champSPlist(champ5); listSP = new SharePointList(list5, "", SPListTemplateType.GenericList); champ.addCollInfo("(aucun)"); champ.addCollInfo("Poste fixe"); champ.addCollInfo("Ordinateur Portable"); champ.addCollInfo("Station Graphique"); listSP.addCollChamps(champ); listSP.creerListInSharePoint(lists); } catch { } //===============creation de la liste 6====================== try { listSP = new SharePointList("Demande Nouvel Arrivant", "", SPListTemplateType.GenericList); champ = new champSPlist("Nom bénéficiaire"); listSP.addCollChamps(champ); champ = new champSPlist("Prénom bénéficiaire"); listSP.addCollChamps(champ); champ = new champSPlist("Login"); listSP.addCollChamps(champ); champ = new champSPlist("Matricule"); listSP.addCollChamps(champ); champ = new champSPlist(SPEncode.HtmlEncode("date d'entrée")); listSP.addCollChamps(champ); champ = new champSPlist("date de sortie"); listSP.addCollChamps(champ); champ = new champSPlist("Statut"); listSP.addCollChamps(champ); champ = new champSPlist("Service"); listSP.addCollChamps(champ); champ = new champSPlist("Fonction"); listSP.addCollChamps(champ); champ = new champSPlist("Lieu de travail"); listSP.addCollChamps(champ); champ = new champSPlist("N° bureau"); listSP.addCollChamps(champ); champ = new champSPlist("Remplacement"); listSP.addCollChamps(champ); champ = new champSPlist("Agent Remplacé"); listSP.addCollChamps(champ); champ = new champSPlist("Téléphone fixe"); listSP.addCollChamps(champ); champ = new champSPlist("Téléphone portable"); listSP.addCollChamps(champ); champ = new champSPlist("Justification téléphone portable"); listSP.addCollChamps(champ); champ = new champSPlist(SPEncode.HtmlEncode("Jour d'utilisation")); listSP.addCollChamps(champ); champ = new champSPlist(SPEncode.HtmlEncode("Portée d'utilisation")); listSP.addCollChamps(champ); champ = new champSPlist("Poste de travail"); listSP.addCollChamps(champ); champ = new champSPlist("Justification du poste de travail"); listSP.addCollChamps(champ); champ = new champSPlist("Accés Internet"); listSP.addCollChamps(champ); champ = new champSPlist("Accés Mail"); listSP.addCollChamps(champ); champ = new champSPlist("Accés à Post-Office"); listSP.addCollChamps(champ); champ = new champSPlist("Accés à Actes-Office"); listSP.addCollChamps(champ); champ = new champSPlist("Accés au logiciel Finance"); listSP.addCollChamps(champ); champ = new champSPlist("Accés à la saisie information DRH"); listSP.addCollChamps(champ); champ = new champSPlist("Besoins spécifiques"); listSP.addCollChamps(champ); champ = new champSPlist("Demandeur"); listSP.addCollChamps(champ); champ = new champSPlist("Fonction du demandeur"); listSP.addCollChamps(champ); champ = new champSPlist("Service du demandeur"); listSP.addCollChamps(champ); champ = new champSPlist("Date_demande"); listSP.addCollChamps(champ); listSP.creerListInSharePoint(lists); } catch { } }
private void GetFragements() { _availableAttachments = new Dictionary <string, DocumentFragment>(); List <ISharePointListItem> fragments = null; if (Cache.Contains(Constants.CacheNames.RenLtrFragments)) { fragments = (List <ISharePointListItem>)Cache.Get(Constants.CacheNames.RenLtrFragments); } else { var list = new SharePointList(Settings.Default.SharePointContextUrl, Settings.Default.GeneralFragmentsListName, Constants.SharePointQueries.RenewalLetterFragmentsByKey); var presenter = new SharePointListPresenter(list, this); fragments = presenter.GetItems(); } foreach (ISharePointListItem i in fragments) { string key = i.GetFieldValue("Key"); string txtTitle = i.Title + " " + i.GetFieldValue("OAMPS_x0020_Version"); switch (key) { case Constants.FragmentKeys.FinancialServicesGuideLetter: { chkFSG.Text = txtTitle; _availableAttachments.Add(key, new DocumentFragment { Title = txtTitle, Key = key, Url = Settings.Default.FragmentFSGLetter }); break; } case Constants.FragmentKeys.GeneralAdviceWarning: { chkWarning.Text = txtTitle; _availableAttachments.Add(key, new DocumentFragment { Title = txtTitle, Key = key, Url = Settings.Default.FragmentWarning }); break; } case Constants.FragmentKeys.PrivacyStatement: { chkPrivacy.Text = txtTitle; _availableAttachments.Add(key, new DocumentFragment { Title = txtTitle, Key = key, Url = Settings.Default.FragmentPrivacy }); break; } case Constants.FragmentKeys.StatutoryNotices: { chkSatutory.Text = txtTitle; _availableAttachments.Add(key, new DocumentFragment { Title = txtTitle, Key = key, Url = Settings.Default.FragmentStatutory }); break; } case Constants.FragmentKeys.UninsuredRisksReviewList: { chkRisks.Text = txtTitle; _availableAttachments.Add(key, new DocumentFragment { Title = txtTitle, Key = key, Url = Settings.Default.FragmentUninsuredRisks }); break; } } } }
/// <summary> /// Populates a SharePointList object from the contents of SharePoint List with the supplied title on the server. /// </summary> /// <param name="title">The title of the list with the list items to retrieve.</param> /// <param name="camlQuery">Optional: The XML representing the CAML query you'd like to make of the list items in /// the list. If not supplied, all items will be retrieved.</param> /// <returns>A SharePointList representing the list on the server, or null if the list could not be found, the /// user does not have sufficient permissions to access the list, or list's contents could otherwise not /// be retrieved.</returns> public SharePointList GetListByTitle(string title, string camlQuery = CAML_GET_ALL_ITEMS) { try { // Get the list from SharePoint. List list = clientContext.Web.Lists.GetByTitle(title); Load(clientContext, list); // Query the list. CamlQuery query = new CamlQuery { ViewXml = camlQuery }; ListItemCollection listItemCollection = list.GetItems(query); Load(clientContext, listItemCollection); // Create a SharePointList object to populate. SharePointList sharepointList = new SharePointList(list, listItemCollection); return sharepointList; } catch { return null; } }
private void RenewalLetter_Load(object sender, EventArgs e) { txtAddressee.Focus(); txtAddressee.Select(); _availableAttachments = new Dictionary <string, DocumentFragment>(); var list = new SharePointList(Settings.Default.SharePointContextUrl, Settings.Default.GeneralFragmentsListName, Constants.SharePointQueries.RenewalLetterFragmentsByKey); var presenter = new SharePointListPresenter(list, this); var fragments = presenter.GetItems(); foreach (ISharePointListItem i in fragments) { var key = i.GetFieldValue("Key"); string txtTitle = i.Title + " " + i.GetFieldValue("OAMPS_x0020_Version"); switch (key) { case Constants.FragmentKeys.FinancialServicesGuide: { chkFSG.Text = txtTitle; _availableAttachments.Add(key, new DocumentFragment { Title = txtTitle, Key = key, Url = Settings.Default.FragmentFSG }); break; } case Constants.FragmentKeys.GeneralAdviceWarning: { chkWarning.Text = txtTitle; _availableAttachments.Add(key, new DocumentFragment { Title = txtTitle, Key = key, Url = Settings.Default.FragmentWarning }); break; } case Constants.FragmentKeys.PrivacyStatement: { chkPrivacy.Text = txtTitle; _availableAttachments.Add(key, new DocumentFragment { Title = txtTitle, Key = key, Url = Settings.Default.FragmentPrivacy }); break; } case Constants.FragmentKeys.StatutoryNotices: { chkSatutory.Text = txtTitle; _availableAttachments.Add(key, new DocumentFragment { Title = txtTitle, Key = key, Url = Settings.Default.FragmentStatutory }); break; } case Constants.FragmentKeys.UninsuredRisksReviewList: { chkRisks.Text = txtTitle; _availableAttachments.Add(key, new DocumentFragment { Title = txtTitle, Key = key, Url = Settings.Default.FragmentUninsuredRisks }); break; } } } var uiScheduler = TaskScheduler.FromCurrentSynchronizationContext(); if (Reload) { base.LoadTreeViewClasses(null); ReloadFields(); } else { datePayment.Value = DateTime.Today.AddDays(14); Task.Factory.StartNew(() => base.LoadTreeViewClasses(uiScheduler)); } base.LoadGenericImageTabs(uiScheduler, tbcWizardScreens, lblCoverPageTitle.Text, lblLogoTitle.Text); }
public void LogUsage(IBaseTemplate template, Enums.UsageTrackingType trackingType) { try { var list = new SharePointList(Settings.Default.SharePointContextUrl, Settings.Default.UsageReportingListName); var presenter = new SharePointListPresenter(list, this); string segment = string.Empty; string wholesaleOrRetail = string.Empty; string title = "Unknown"; string userDep = "Unable to locate"; string userOffice = "Unable to locate"; string type = GetType().Name; switch (type) { case "InsuranceRenewalReportWizard": { var form = ((InsuranceRenewalReportWizard)this); segment = ConvertSegementToNumberical(form.SelectedSegment); wholesaleOrRetail = form.SelectedStatutory.ToString(); title = Constants.TemplateNames.InsuranceRenewalReport; break; } case "ClientDiscoveryWizard": { //var form = ((ClientDiscoveryWizard) this); title = Constants.TemplateNames.ClientDiscovery; break; } case "PreRenewalAgendaWizard": { //var form = ((PreRenewalAgendaWizard) this); title = Constants.TemplateNames.PreRenewalAgenda; break; } case "RenewalLetterWizard": { //var form = ((RenewalLetterWizard) this); title = Constants.TemplateNames.RenewalLetter; break; } case "SummaryOfDiscussionWizard": { //var form = ((SummaryOfDiscussionWizard) this); title = Constants.TemplateNames.FileNote; break; } case "GenericLetterWizard": { //var form = ((GenericLetterWizard)this); title = Constants.TemplateNames.GenericLetter; break; } case "PreRenewalQuestionareWizard": { title = "Fact Finder"; //todo: need to move this to constants once we can update value in ShaerPoint. (currently Pre Renewal Questionaire and cannot be changed until new wizard is released) break; } case "FactFinderWizard": { title = "Fact Finder"; //todo: need to move this to constants once we can update value in ShaerPoint. (currently Pre Renewal Questionaire and cannot be changed until new wizard is released) break; } case "QuoteSlipWizard": { title = Constants.TemplateNames.QuoteSlip; break; } case "InsuranceManualWizard": { title = Constants.TemplateNames.InsuranceManual; break; } case "ShortFormProposalWizard": { title = Constants.TemplateNames.ShortFormProposal + " - " + template.DocumentTitle; break; } case "PlacementSlip": { title = "Placement Slip"; break; } default: { title = template.DocumentTitle; break; } } Task.Factory.StartNew(() => { UserPrincipalEx user = FindCurrentUserInAd(); if (user != null) { userDep = user.Branch; userOffice = user.Suburb; } presenter.LogUsage(trackingType.ToString(), title, template.ExecutiveName, userDep, userOffice, template.ClientName, segment, wholesaleOrRetail, DateTime.Now.ToShortDateString(), DateTime.Now.TimeOfDay.ToString()); }, CancellationToken.None).ContinueWith((task => { if (task.IsFaulted) { OnError(task.Exception); } })); } catch (Exception ex) { OnError(ex); } }
public void LogUsage(IBaseTemplate template, Helpers.Enums.UsageTrackingType trackingType) { var list = new SharePointList(Settings.Default.SharePointContextUrl, Settings.Default.UsageReportingListName); var presenter = new SharePointListPresenter(list, this); var segment = string.Empty; var wholesaleOrRetail = string.Empty; var title = "Unknown"; var userDep = "Unable to locate"; var userOffice = "Unable to locate"; var type = this.GetType().Name; switch (type) { case "InsuranceRenewalReportWizard": { var form = ((InsuranceRenewalReportWizard)this); segment = ConvertSegementToNumberical(form._selectedSegment); wholesaleOrRetail = form._selectedStatutory.ToString(); title = Constants.TemplateNames.InsuranceRenewalReport; break; } case "ClientDiscoveryWizard": { var form = ((ClientDiscoveryWizard)this); title = Constants.TemplateNames.ClientDiscovery; break; } case "PreRenewalAgendaWizard": { var form = ((PreRenewalAgendaWizard)this); title = Constants.TemplateNames.PreRenewalAgenda; break; } case "RenewalLetterWizard": { var form = ((RenewalLetterWizard)this); title = Constants.TemplateNames.RenewalLetter; break; } case "SummaryOfDiscussionWizard": { var form = ((SummaryOfDiscussionWizard)this); title = Constants.TemplateNames.FileNote; break; } } Task.Factory.StartNew(() => { var user = FindCurrentUserInAD(); if (user != null) { userDep = user.Branch; userOffice = user.Suburb; } presenter.LogUsage(trackingType.ToString(), title, template.ExecutiveName, userDep, userOffice, template.ClientName, segment, wholesaleOrRetail, DateTime.Now.ToShortDateString(), DateTime.Now.ToString("h:mm.ss tt")); }, CancellationToken.None); }
/// <summary> /// Create a database object. /// </summary> /// <param name="connectionStringBuilder">Database-specific connection string</param> /// <returns>Database driver.</returns> public IDbDriver CreateDatabaseObject(DbConnectionStringBuilder connectionStringBuilder) { IDbDriver instance = new SharePointList(); instance.ConnectionString = connectionStringBuilder.ToString(); return instance; }
public async Task <ActionResult> CreateCustomersList() { SharePointList list = await SharePointSiteManager.CreateCustomersList(); return(View(list)); }
public async Task <Boolean> CheckRegistration(string accessToken, SharePointSite spSite, SharePointList spList) { UserInfo me = await getMe(accessToken); List <Item> items = await GetItems(accessToken, spSite, spList); foreach (var item in items) { if (item.fields.UPN.Equals(me.userPrincipalName)) { return(true); } } return(false); }
public async Task <string> Matchpeople(string accessToken, SharePointSite spSite, SharePointList spList) { // Get all items string endpoint = "https://graph.microsoft.com/v1.0/sites/" + spSite.id + "/lists/" + spList.Id + "/items/"; string queryParameter = "?expand=fields"; ListItems ListItems = null; using (var client = new HttpClient()) { using (var request = new HttpRequestMessage(HttpMethod.Get, endpoint + queryParameter)) { request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", accessToken); // This header has been added to identify our sample in the Microsoft Graph service. If extracting this code for your project please remove. request.Headers.Add("SampleID", "aspnet-connect-rest-sample"); using (var response = await client.SendAsync(request)) { if (response.IsSuccessStatusCode) { string stringResult = await response.Content.ReadAsStringAsync(); ListItems = JsonConvert.DeserializeObject <ListItems>(stringResult); } } //return await SetupDateWithoutMySkill(accessToken, ListItems.Items); //return await SetupDateWithMySkill(accessToken, ListItems.Items); return(await SetupDateAnyone(accessToken, ListItems.Items)); } } }
public async Task <string> RegisterToEatAPI(string accessToken, SharePointSite spSite, SharePointList spList) { string endpoint = "https://graph.microsoft.com/v1.0/sites/" + spSite.id + "/lists/" + spList.Id + "/items/"; UserInfo me = await getMe(accessToken); using (var client = new HttpClient()) { using (var request = new HttpRequestMessage(HttpMethod.Post, endpoint)) { ItemCreated item = new ItemCreated() { fields = new FieldsCreated { Title = "Je veux manger", DisplayName = me.displayName, UPN = me.userPrincipalName } }; request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", accessToken); request.Content = new StringContent(JsonConvert.SerializeObject(item), Encoding.UTF8, "application/json"); using (var response = await client.SendAsync(request)) { if (response.IsSuccessStatusCode) { return(Resource.Graph_RegisterToEatAPI_Success_Result); } return(response.ReasonPhrase); } } } }
public async Task <IList <SharepointPostImages> > GetImages(SharePointList list, int id) { var files = await _sharePointClient.GetImages(list.Title, id, list.BasePathExtension); return(files); }
public async Task <IList <SharepointPost> > GetPosts(SharePointList list) { var posts = await _sharePointClient.GetListPostAsync(list.Title, list.BasePathExtension); return(posts); }
public ActionResult CreateCustomersList() { SharePointList list = SharePointSiteManager.CreateCustomersList(); return(View(list)); }
public HelpWizard() { InitializeComponent(); //todo: max we need to move this off accessing the word document directly. //todo: move this to the presenter for Help. var find = Globals.ThisAddIn.Application.Selection.Find; var r = Globals.ThisAddIn.Application.Application.Selection.Move(); //error handling needed. // ReSharper disable UseIndexedProperty find.set_Style(Globals.ThisAddIn.Application.ActiveDocument.Styles[BusinessLogic.Helpers.Constants.WordStyles.Heading1]); // ReSharper restore UseIndexedProperty find.Text = String.Empty; find.Forward = false; find.MatchWildcards = true; find.Execute(); var heading = Globals.ThisAddIn.Application.Selection.Text; if (!String.IsNullOrEmpty(heading)) { heading = heading.Replace("\r", string.Empty).Trim(); var templateName = ((DocumentProperties)(Globals.ThisAddIn.Application.ActiveDocument.BuiltInDocumentProperties))[ WdBuiltInProperty.wdPropertyTitle].Value.ToString(); //todo max not able to use anthing off globals.thisaddin in wizard screens. move this to a helpPresenter. //todo max move these to constants, there is a caml query constants class var query = "<View>" + "<Query>" + "<Where>" + "<And>" + "<Eq><FieldRef Name='Template' /><Value Type='Lookup'>" + templateName + "</Value></Eq>" + "<Eq><FieldRef Name='Title' /><Value Type='Text'>" + heading + "</Value></Eq>" + "</And>" + "</Where>" + "</Query>" + "</View>"; //todo max move the list to a settings var helpList = new SharePointList(Settings.Default.SharePointContextUrl, "Word Help Content", query); var presenter = new SharePointListPresenter(helpList, this); var fitem = presenter.GetHelpItems().FirstOrDefault(); if (fitem != null) { webHelpWindow.DocumentText = fitem.GetFieldValue("Content"); //todo: max move the fieldname to a constants } else { //todo max move these to constants, there is a caml query constants class var generalHelp = "<View>" + "<Query>" + "<Where>" + "<And>" + "<Eq><FieldRef Name='Template' /><Value Type='Lookup'>" + templateName + "</Value></Eq>" + "<Eq><FieldRef Name='Title' /><Value Type='Text'>" + "Wizard Help" + "</Value></Eq>" + "</And>" + "</Where>" + "</Query>" + "</View>"; helpList.UpdateCamlQuery(generalHelp); var gitem = presenter.GetHelpItems().FirstOrDefault(); webHelpWindow.DocumentText = gitem != null?gitem.GetFieldValue("Content") : "Unable to find the help content for this document"; } } // Globals.ThisAddIn.Application.Application.Selection.GoTo(WdGoToItem.wdGoToTable) }