Monthly Archives: October 2016
Google URL Shortener for SharePoint items
You can shorten URLs to make them easier to share using the Google URL shortener. For example, the short URLhttp://goo.gl/l6MS
This is a good way to share and generate short links to share documents.
1) you need to get the API Key for: https://developers.google.com/url-shortener/
2) Install Google APIs Client Library, using NuGet
3) Check all References
4) Use the following method to generate ShortLink
public static string UrlShorter(string largeUrl)
{
var finalUrl = string.Empty;
var key = "API KEY GOOGLE"
var post = "{\"longUrl\": \"" + largeUrl + "\"}";
var request = (HttpWebRequest)WebRequest.Create(
"https://www.googleapis.com/urlshortener/v1/url?key=" + key);
try
{
request.ServicePoint.Expect100Continue = false;
request.Method = "POST";
request.ContentLength = post.Length;
request.ContentType = "application/json";
request.Headers.Add("Cache-Control", "no-cache");
using (var requestStream = request.GetRequestStream())
{
byte[] postBuffer = Encoding.ASCII.GetBytes(post);
requestStream.Write(postBuffer, 0, postBuffer.Length);
}
using (var response = (HttpWebResponse)request.GetResponse())
{
using (var responseStream = response.GetResponseStream())
{
if (responseStream != null)
using (var responseReader = new StreamReader(responseStream))
{
var json = responseReader.ReadToEnd();
var jss = new JavaScriptSerializer();
var dict = jss.Deserialize<Dictionary<string, string>>(json);
finalUrl = dict["id"];
}
}
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.Message);
System.Diagnostics.Debug.WriteLine(ex.StackTrace);
}
return finalUrl;
}
Thanks
Failed to Register SharePoint Services in PSConfig (Fix)
Unfortunately this happens on Stand Alone servers more often than you would think. Good news is that there is a really quick way to fix this.
Open up Regedit and browse to:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office Server\15\LauncherSettings
Create the following key:Type: DWORD
Name: AcknowledgedRunningOnAppServer Value: 1
Then do the same thin in the following registry:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office Server\15\LoadBalancerSettings
No need to restart, just rerun PSConfig and you should be good to go.
Original: http://sharepoint-community.net/profiles/blogs/failed-to-register-sharepoint-services-in-psconfig