Calling a webpplication with authentication in C#
Question : do you know the method to call a sharepoint web appliaction in C#?
As well i Think i’ll have to call a credential method in order to get authenticated
I am a real beginner in C#, your advices would help a lot
Thanx
Here is the solution I’m building a new console app solution whith the I’ve extracted from a big SharePoint solution I want this new solution to work independently
Here is the piece I’ve modified
///////public override void Execute(Guid targetInstanceId)///// public void Execute() { SPSecurity.RunWithElevatedPrivileges(delegate () { //base.Execute(targetInstanceId); using (SPSite oSite = new SPSite("http://mywebsiteurl/")) { using (SPWeb web = oSite.OpenWeb()) { if (_oWeb != null) { _TemplateXml = ParamHelper.GetXmlTemplate(_oWeb, "Notice_Template.xml"); _ServeurSMTP = ParamHelper.getParamExportNoticeByKey(_oWeb, "SERVEUR_SMTP"); _MailDestinataire = ParamHelper.getParamExportNoticeByKey(_oWeb, "ERROR_MAIL_DESTINATAIRE"); _MailExpediteur = ParamHelper.getParamExportNoticeByKey(_oWeb, "ERROR_MAIL_EXPEDITEUR"); _TableNotices = ParamHelper.getParamExportNoticeByKey(_oWeb, "TableSQL"); _NomDossierSauvegarde = ParamHelper.getParamExportNoticeByKey(_oWeb, "NomDossierSauvegarde"); _LecteurRacine = ParamHelper.getParamExportNoticeByKey(_oWeb, "Racine"); _SrvDepot = ParamHelper.getParamExportNoticeByKey(_oWeb, "SRV_DEPOT"); //ParamTechnique oParamTechnique = new ParamTechnique(_oWeb); _PathDossierArchivePourExtranets = ParamHelper.getParamExportNoticeByKey(_oWeb, "CheminArchivesPourExtranets"); _ConnectionString = ParamHelper.getParamExportNoticeByKey(_oWeb, "BDD_CONNEXION"); _DateExport = DateTime.Now; this.Export(); } } } }); }
I Found how to resolve the first issue of the webapp call
I’ve modified the code below
As I will work in local I don’t need to manage the credential at least I put SPSecurity.RunWithElevatedPrivileges and it seems to work for the moment