VBA code to notify a user that an Excel document has already been checked out if they attempt to edit it

I have a working, macro enabled Excel sheet on a SharePoint site for about 20 people to all use. I have it set so that it requires to be checked out in order to edit (So that only one person can edit at a time).

This has been working great, except some users of this file either ALWAYS forget to check the “check out and edit” option rather than “read only.” So they will make changes in “Read Only” mode, and end up saving a copy of it on their own computers (because it wasn’t checked out).

I was wondering if it were possible to make some sort of VBA event that checks to see if the document has been checked out of SharePoint before any changes are made, and if it hasn’t, it shows a message box telling them so that they may close it out and re-open in “checked out” mode.

How to Set up Search for Extended Web applications Sp2013

I just extended a web application to publish site in world wide web. i was able to browse the site using this new URl, everything was going fine except when i found out my search was not crawling all the contents in the extended site. In original Site everything is fine and working. Do i need to set up any other settings for extended site to provide search results.

Thank You

Office 365 Document library Sync option not enabled

I had a team site owner contact me wondering why they can’t sync to a new file library that they’ve created. (See image.)

enter image description here

So I went and did some exploring. They added a bunch of content types, and changed the default content type to a visio file and changed the default template to a visio. I got the document content type to be default and added a word document to be the template. Didn’t make any difference.

They have content approval turned on, I thought that might cause it. It doesn’t.

They have check out turned on to edit, that didn’t matter either.

I thought it might be an Asset Library, it isn’t.

You can still connect to Windows File Explorer up on the Library ribbon. When I copy the library and create a template of it, it still retains the same behaviour.

When I create a new document library in that site, it works fine.

I must be missing something, but I’m running out of ideas. Any assistance would be appreciated.

Getting Calendar items on Office 365 using REST API

I am having trouble with a REST call using jQuery on Office 365 and was wondering if you guys have ever experienced something similar and could give me some hints?

What I am trying to achieve is to get “My Today’s Events” from my calendar on Office 365 using REST API and jQuery, however, I haven’t had any success so far.

Here is my code:

function rest_call(){    try {     var calendarUrl = "https://outlook.office365.com/ews/odata/Me/Events";     var calendarItems_html = "<div class='title'> Today's Schedule </div>";      $  .ajax({         url: calendarUrl,         method: "GET",         headers: { "Accept": "application/json; odata=verbose" },             success: function (data) {                 $  .each(data.value, function (i, item) {                       if(item.IsAllDay)                                                calendarItems_html += "<div class='item'><img src='/sites/mytheme/Style%20Library/mytheme/images/schedule-arrow.png' alt=''/><span class='time'> " + getDate(item.Start) + " </span><span class='content'>" + item.Subject + "</span></div>";                                else {                                               calendarItems_html += "<div class='item'><img src='/sites/mytheme/Style%20Library/mytheme/images/schedule-arrow.png' alt=''/><span class='time'> " + getTime(item.Start) + "&nbsp;-&nbsp;" + getTime(item.End) + " </span><span class='content'>" + item.Subject + "</span></div>";                         }                     });                   $  (".schedule").append(calendarItems_html);             },             error: function (err) {                 $  (".schedule").append(err);             }         }); } catch(err) {     $  (".schedule").append(err);     } 

}

function getDate(ddate){   var dDateHours= ddate.substring(0,10);   return dDateHours; }  function getTime(ddate){   var dDateHours= ddate.substring(16,11);   return dDateHours; } 

This code only returns data if the site and outlook.office365.com are added into one security zone (in IE) and the security settings are set to Low!

Could you please let me know what my mistake is and what’s the right way of achieving this goal?

Sharepoint-hosted app on-premise 2013

We have been developing SharePoint-hosted apps for SP online with great success, but seems like developing SharePoint-hosted apps for the on-premise 2013 is not so intuitive process.

Questions:

  1. As a rule of thumb, should we NOT create sharepoint-hosted apps on the on-premise?
  2. For every new deployment version, unless users go to Site Content and Trust the app, it wont appear on the with X-Frame-Option = SAME ORIGIN error. Note that all of my ClientWebParts include the AllowFraming tag. We also use plenty of the AppContextSite Lists. Isn’t there any way to set my app as trusted, so that any user visiting the page hosting the AppPart, be able to see the content of my app?

    • None of this issues exist on the online version and i was wondering if the sharepoint-hosted apps are not meant to be deployed on the on-premise.

** This thread is based on another thread i raised recently, but I thought to create a new one for narrowing the problems I have! Do not down-vote for duplication ! https://sharepoint.stackexchange.com/questions/115708/sharepoint-hoted-apps-for-sharepoint-2013-x-frame-options-error

UPDATE 1: point 2 revised

In point 2 I mentioned that my app requires Trust from all users. The correct is that the app requires login from all users visiting Site Contents before they can view it on the page. Here is the revised point 2.

  1. For every new deployment version, unless users go to Site Content open the app and insert their credentials, it wont appear on the page with X-Frame-Option = SAMEORIGIN error. Note that all of my ClientWebParts include the AllowFraming tag. We also use plenty of the AppContextSite Lists. Isn’t there any way to login without going to the Site Contents or event better to use the Site credentials and login directly without extra effort from the user?

Programmatically create content database in C# (SP 2013)

The goal is to have a web user interface with the option to create new site collections with new Content Database.

With the admin user I can manually in the CA create new Content Databases. I can also create a new site collection in this content database.

The idea was to create an event receiver (C#). If the user adds data to a table, the mentioned actions are to be executed.

Experiments: a) Console application – works!

using (SPSite site = new SPSite("http://sp2013")) {   using (SPWeb spWeb = site.OpenWeb()) {       SPWebApplication elevatedWebApp = spWeb.Site.WebApplication;         elevatedWebApp.ContentDatabases.Add("sp2013", "WSS_Content_80_" + DateTime.Now.ToString("yyyymmddhhMMss"), null, null, 10, 15, 0);     } } 

b) Event Receiver – Only create site collections works, creation of content databases does not work! Error: Access Denied.

c) Web Service – Does not work! Error: Access Denied.

So, why do I get the error Access Denied when I can create site collections, but only content databases creation not go?

Finally I executed PS Script – but this also doesn´t work.

# AUTHOR: Paul Kotlyar # CONTACT: unclepaul84@gmail.com # DESCRIPTION: sets an option on content web service that allows updating of SP Administration objects such as SPJobDefinition from content web applications function Set-RemoteAdministratorAccessDenied-False() {     # load sharepoint api libs     [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") > $  null     [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Administration") > $  null    # get content web service  $  contentService = [Microsoft.SharePoint.Administration.SPWebService]::ContentService   # turn off remote administration security  $  contentService.RemoteAdministratorAccessDenied = $  false   # update the web service  $  contentService.Update() } 

Maybe somebody knows a solution?