Skip to main content

Posts

Showing posts from February, 2015

How to Send Email in SharePoint Provider Hosted Apps

There are few methods that we can use to send Emails in SharePoint Provider Hosted apps. Using general Email Sending method Using SharePoint Client Object Model (CSOM) Using SharePoint JavaScript Model (JSOM) Using general Email Sending method This is the general method we are using for sending email for asp.net. This is method has advantages over other two methods. this method has few advantages over other methods, Send attachments to the recipients Send emails to external users (SharePoint 2013 email function can not be used to send emails to external users)  There are many articles in available for this , I’m describing a sample code below. MailMessage mail = new MailMessage( "from@mail.com" , "to@mail.com" ); SmtpClient client = new SmtpClient(); client.Port = 25; client.DeliveryMethod = SmtpDeliveryMethod.Network; client.UseDefaultCredentials = false ; client.Host = "smtp.google.com" ; mail.Subject = "this is a test email." ; m

JSOM List Operations in SharePoint Apps in a proper way (Provider Hosted and SharePoint Hosted)–CRUD

  SharePoint list operations are common for every SharePoint app. I have created a set of operation library which is combined with jQuery Deferred objects to  make the life easier. As a set of methods you can keep update the source and I will provide a more updated version later. List Operations in JSOM ( function (spa, $, undefined) { window._sa = spa; _sa.ctx = null ; _sa.web = null ; // this should be initialised _sa.configs = { SPHostUrl: "" , SPAppWebtUrl: "" , isCrossDomain: false }; // init(); utils.log(_sa.configs.SPHostUrl); utils.log(_sa.configs.SPWebtUrl); function init() { if (!_sa.configs.SPAppWebtUrl) { alert( "Please initialize _sa.configs" ); } if (_sa.configs.isCrossDomain) { _sa.ctx = new SP.ClientContext(_sa.configs.SPAppWebtUrl); var factory = new SP.ProxyWebRequestExecutorFactory(_sa.configs.SPAppWebtUr

THE PROVIDED APP DIFFERS FROM ANOTHER APP WITH THE SAME VERSION AND PRODUCT ID in SharePoint 2013 App Development

  How I got this error it is strange. My app was working perfectly until I change some list definition in my source. suddenly I got this error. I tried to revert the definition and deploy it again but still it gave the error. You can try following steps Resolution Retract the app using visual studio, and check the site collection whether it is available in Site Contents . if so first remove it. Then check the app availability in Apps Packages and Apps on testing lists. if it is there delete it. Then check the recycle bin and Admin recycle bin and empty if any. and tried to deployed the app. If it is not working you may have App deployed to other sub sites as well. So go there and delete every thing. If it is a O365 , go to Share Point administration then Go to Apps –> App permissions and  delete the items related to the app. if this wont work , try with new site collection.