Skip to main content

Posts

Showing posts with the label HTML

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...

Working with client side relative Url Tokens in SharePoint 2010/2013

Most of the time we are having problems with Getting relative site collection URL in client side Getting relative Layout URL in client side Getting web site URL in client side when we are developing SharePoint applications. (for an example Creating a custom master page and providing links to content inside the SharePoint). If we are working with SharePoint  Standard or Enterprise we can  use < link rel= "stylesheet" type= "text/css" runat= "server" href= "<% $SPUrl:~sitecollection/Style%20Library/mystyle.css %>" /> But to work with SPUrl you need the control to be server control ( runat = server ). Other Possible Url tokens are ~site/ ~sitecollection/    ~language there are few other undocumented Tokens as well . Other than that you can use _spPageContextInfo JavaScript Objet in all SharePoint versions. <script type= "text/javascript" > function goToLink(link) { location.href = _spPageContextInfo.web...

Change the IE Compatibility Mode manually

We can set HTML rendering mode using Meta Tag. < meta http-equiv ="X-UA-Compatible" content ="IE=5" /> This is set compatible mode to IE-5, like wise there are few modes we can set using a meta tag. content="IE=5" - force to render in “Quirks” mode. content="IE=7" - forces to render in IE 7 Strict mode. content="IE=EmulateIE7" - use !DOCTYPE declaration to detect rendering mode content="IE=8" -   forces to render Internet Explorer Standards mode. content="IE=EmulateIE8" - use !DOCTYPE declaration to detect rendering mode content="edge" - use most recent mode Reference   http://hsivonen.iki.fi/doctype/ We can use  Web Config to alter the page rendering mode < httpProtocol > < customHeaders > < remove name ="X-UA-Compatible" /> < add name ="X-UA-Compatible" value ="IE=edge" /> </ customHeaders > </ httpProtocol >

Create a SharePoint 2013 List Using JSOM (ECMAScript Client Object Model)

JSOM (JavaScript client object model) heavily used in SharePoint App model. I'm going to post series of basic operations that can archive using jsom. First add these references to your page. //Add jquery version correctly <script type= "text/javascript" src= "../Scripts/jquery-1.7.1.min.js" ></script> <script type= "text/javascript" src= "https://ajax.aspnetcdn.com/ajax/4.0/1/MicrosoftAjax.js" ></script> <script type= "text/javascript" src= "/_layouts/15/init.js" ></script> <script type= "text/javascript" src= "/_layouts/15/sp.runtime.js" ></script> <script type= "text/javascript" src= "/_layouts/15/sp.js" ></script> Then add following script to create the list. <script type= "text/ecmascript" > function createList() { var clientContext = new SP.ClientContext.get_current(); ...

Apps for SharePoint 2013 @ SharePoint Forum

Apps for SharePoint from Melick Baranasooriya

Step by Step guide to create a Client App Part in SharePoint Hosted Development Environment.

I think you already know about hosted approaches in SharePoint 2013. There are three types of hosted approaches ( SharePoint-Hosted, Provider-Hosted, Auto-Hosted ).  Though there are similarities as well as differences. Thus there are slightly differences in developing client app part in SharePoint Hosted Model.    This is Step by Step Guide to Create a Client App part. Create a Visual Studio Project by specifying SharePoint Hosted option. Then Visual Studio will create a project for you. ( If you looked closely you can find out it is referring jQuery 1.6.2 version that is quite old. So if you want you can right click the project and go to NuGet Manager and install new version. ) Now we are going to add a Client App part. Client App Apart is concept which allows to run SharePoint pages inside the iFrame. Therefore you can theoretically display any page inside the client app part. As a guide I will show two types of Client App Parts. Simple A...

How to center a Div Horizontally and Vertically

  .wrapper { width : 100% ; height : 100% ; background-color : aqua ; } .body { width : 600px ; height : 300px ; background-color : #567 ; position : absolute ; left : 50% ; top : 50% ; margin-left : -300px ; margin-top : -150px ; } we set wrapper class to parent container. then set body css to child div which needs to center in the screen.  

ie window.open not working

When I tried to open a new window using JavaScript it worked for Google Chrome and IE. but didn’t work in IE. window.open( 'url ' , 'B HELP' , 'width=650' ); I found that space character in title bar cause the error. Therefore I used the following code and it worked fine. window.open( 'url ' , 'B-HELP' , 'width=650' );

InfoPath Forms not working (Rendering) in My Custom Master Page in SharePoint 2010

Recently i have created a master page based on the StarterMaster page giving in the Codeplex/Msdn. But i got a problem that InfoPath forms are not working in the master page i created. By analyzing the  V4.master page i found that Body tag Java Script is different. <body onload="javascript:if (typeof(_spBodyOnLoadWrapper) != 'undefined') _spBodyOnLoadWrapper();">

How to Customize SharePoint List Content Display using Content Query Web Part

Here I'm going to describe how we can use Content Query Web Part to Style SharePoint List. Thus Assume we are having a  SharePoint List Called Projects with Following Fields. As you already knew default look and feel would be like below. Now I'm going to render this list in to format something like below. Step One First you need to define Some names for these place holders ( Yeh., I know this do not make any sense to you. But don’t worry just do the step ). Thus I'm going to define these columns as follows. Title –> MyTitle Logo –> MyLogo Project Summary –> MySummary Project Description –> MyDesc Step Two Now you want to define a XSL Style Sheet using these names. Therefore I'm going to use <table> to layout the list item as below. < xsl:template name ="MyStyle" match ="Row[@Style='MyStyle']" mode ="itemstyle" >   < table border ='1' > < tr > < td ...