Category Archives: Visual Studio

SEO – Change Meta Tags Dynamically in SharePoint or Asp.net – (JavaScript & C#) – Google Crawlers

Google-Crawl-Index-550x331

Meta tags are a great way for webmasters to provide search engines with information about their sites. They can be used to provide information to all sorts of clients, and each system processes.

Meta tags are added to the <head> section of your HTML page and you can add them dynamically use JavaScript when page load or using c#:

The following examples explain how can you add it on your header Page:

1. Use c#

public static void ApplyTagsCSharp(string xtitle, string xkeywords, 
string xdescription, Page page)
        {
            page.Title = xtitle;
            ContentPlaceHolder contentPlaceHolder = 
           (ContentPlaceHolder)page.Master.FindControl("PlaceHolderPageTitle");
            contentPlaceHolder.SetRenderMethodDelegate
            (delegate(System.Web.UI.HtmlTextWriter writer,
            System.Web.UI.Control Container)
            {
                writer.Write(xtitle);
            });

            ////Add Keywords Meta Tag
            HtmlMeta keywords = new HtmlMeta();
            keywords.HttpEquiv = "keywords";
            keywords.Name = "keywords";
            keywords.Content = xkeywords;
            page.Header.Controls.Add(keywords);

            //Add Description Meta Tag
            HtmlMeta description = new HtmlMeta();
            description.HttpEquiv = "description";
            description.Name = "description";
            description.Content = xdescription;
            page.Header.Controls.Add(description);
        }

2. Use JavaScript with ClientScriptManager

public static void ApplyTagsJS(string title, string keywords, 
string description, string author, ClientScriptManager csx, System.Type tp)
        {
            String csname2 = "isTagFunction";
            Type cstype2 = tp;

            if (!csx.IsStartupScriptRegistered(cstype2, csname2))
            {
                StringBuilder cstext2 = new StringBuilder();
                cstext2.Append("");
                if (!string.IsNullOrEmpty(keywords))
                {
                    cstext2.Append("$('meta[name=keywords]').remove();");
                    cstext2.AppendFormat("$('head').append( '');", keywords);
                }
                if (!string.IsNullOrEmpty(description))
                {
                    cstext2.Append("$('meta[name=description]').remove();");
                    cstext2.AppendFormat("$('head').append( '' );", description);
                }
                if (!string.IsNullOrEmpty(title))
                {
                  cstext2.AppendFormat("document.title = \"{0}\"; ", title);
                }
                csx.RegisterStartupScript(cstype2, csname2, cstext2.ToString());
            }
        }

Thanks

SharePoint 2016 – Project Template for Visual Studio Available

Microsoft Office Developers Tools for Visual Studio 2015 https://www.microsoft.com/en-us/download/details.aspx?id=49972 includes the templates for developing SharePoint farm and sandboxed solutions for SharePoint 2016.

VSSHP

Before you install,  you need to have Visual Studio 2015 Installed  https://www.visualstudio.com/post-download-vs?sku=community

Thanks

 

 

New ASP.Net Core 1.0

In 2002… was born ASP.NET … after 15 years we are presenting a new framework ASP.NET 5 and replace ASP.NET 4.6…

ASP.NET 5 is now ASP.NET Core 1.0.

.NET 5 is now .NET Core 1.0.

Entity Framework 7 is now Entity Framework Core 1.0 or EF Core 1.0

.NET Core introduce a new concept multi-platform and open source as you can see on the following image:

net core

for more info about .net core check the following links:

https://github.com/dotnet/core

http://docs.asp.net/en/latest/getting-started/installing-on-linux.html

https://blogs.msdn.microsoft.com/dotnet/2014/12/04/introducing-net-core/

Thanks

Integrate MailChimp in SharePoint/ ASP.net Solutions

MailChimp is an email marketing service and the trading name of its operator, it was sending over 10 billion emails per month on behalf of its users.

MailChimp integrates with the web services you already use, so you can easily sync your data, import content from other sources, and get reports on how your newsletters are impacting your business.

if you what use MailChimp on .net/C# Solutions, you can use API following the steps:

First install the NuGet package: Install-Package mcapi.net

mailchimp nuget

The following example explains how to use it.

static void Main(string[] args)
{
  const string apiKey = "6ea5e2e61844608937376d514-us2";  // Replace it before
  const string listId = "y657cb2495";                     // Replace it before
   
  var options = new List.SubscribeOptions();
  options.DoubleOptIn = true;
  options.EmailType = List.EmailType.Html;
  options.SendWelcome = false;

  var mergeText = new List.Merges("fcsharepoint@outlook.com",List.EmailType.Text)
                  {
                        {"NAME", "Fábio Carvalho"},
                   };
  var merges = new List<List.Merges> { mergeText };
  var mcApi = new MCApi(apiKey, false); 
  var batchSubscribe = mcApi.ListBatchSubscribe(listId, merges, options);
        
        if (batchSubscribe.Errors.Count > 0)
        {
            Console.WriteLine("Error:{0}", batchSubscribe.Errors[0].Message);
        }
        else
        {
            Console.WriteLine("Success");
        }
    Console.ReadKey();
    }

Useful links:

http://perceptivemcapi.codeplex.com/

http://mailchimp.com/

Thanks

Office Tools For Visual Sudio 2015 – for SharePoint

If you are new on Visual Studio 2015 and you would like to use it for sharepoint projects you could make the download of Office Tools For Visual Sudio 2015 on the following link:

https://www.visualstudio.com/en-us/features/office-tools-vs.aspx

Thanks