SharePoint Apps – Can we have multiple Client Webpart in a sharePoint app?


Can we have multiple Client Webpart in a sharePoint app? If so, do we need to do any configurations?

SharePoint Apps – What is App catalog?


What is SharePoint Application catalog? and where do we use this?

Get all subsites of top level site using JavaScript OM


I am trying to get all sub sites of the top level site. However, the code I wrote for the app returns zero subsites. I am a little mystified as to why:

var context = SP.ClientContext.get_current();
var user = context.get_web().get_currentUser();
var web = context.get_web();
var lists = web.get_lists();

// this is used later to hold the sub webs found
var webCollection = null;

function getSubWebs(){
    webCollection = web.getSubwebsForCurrentUser(null);
    context.load(webCollection)
    context.executeQueryAsync(onGetSubwebsSuccess, onGetSubwebsFail);
    log("executing getSubWebs query");
}

function onGetSubwebsSuccess(sender, args){
    log("getSubWebs query successful")
    alert("Number of sites: " + webCollection.get_count());
    var selectSubwebsBox = $("#selectsubwebs");
    var webEnumerator = webCollection.getEnumerator();
    //clearSubWebList();

    while (webEnumerator.moveNext()){
        var web = webEnumerator.get_current();

        log("Adding " + web.get_title + " to the subwebs list.")
        selectSubwebsBox.append($("<option>", { value: web.get_title })).text(web.get_title);
    }
}

function onGetSubwebsFail(sender, args){
    log("getSubWebs query failed")
    alert("Request to retrieve subwebs failed. Error: " + args.get_message())
}

function clearSubWebList(){
    $("#selectsubwebs").find("option").remove();
    log("SubWebsList cleared");
}

function log(msg){
    // not all browser support console/logging
    if (window.console){
        window.console.log(msg);
    }
}

Why is the SharePoint Javascript OM methods returning zero subsites? Is this not the correct way to do this?

Sharepoint 2013 provider hosted app with claim base authentication


  • We have Sharepoint 2013 single server farm – Server 1
  • another one server with ADFS 2.0 – Server 2
  • MVC webapplication (hosted in iis) – Server 3 – Remote Computer

We are using Sharepoint 2013 Provider hosted app.

CASE 1:
Provider Hosted App is getting installed successfully with Windows Authentication on SharePoint 2013 site. This is working fine.

Case 2:

We have configured ADFS 2.0 for authenticating users.
ADFS 2.0 is successfully installed and configured. Users are getting authenticated. After configure claim base authentication we are also able to login with adfs user into our sharepoint site and authenticate users.

However, Issue is

  • Now whenever we deploy our provider hosted app with this SharePoint site from visual studio 2012 it will give an error.

Error occurred in deployment step ‘Install app for SharePoint’: The System Account cannot perform this action.>

  • another way we have added app package file into our app catalog then try to add an app from app catalog it is ask for trust and then can not able to redirect our provider hosted app
    Sharepont Log file Error

Application error when access /_layouts/15/appInv.aspx, Error=This App is not installed on this site. at Microsoft.SharePoint.Lifecycle.SprocWrappers.GetAppInstanceById(SqlSession dbSessionWrapper, Guid siteId, Guid webId, Guid instanceId, Int32 lcid) at Microsoft.SharePoint.Administration.SPAppCatalog.GetAppInstance(SPWeb web, Guid appInstanceId) at Microsoft.SharePoint.ApplicationPages.AppInvPage.SetControlStateUsingAppInstanceId(String appInstanceId) at Microsoft.SharePoint.ApplicationPages.AppInvPage.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Thanks in advance.

Change content type order via Javascript/ECMAscript


In my SharePoint-hosted app, I use javascript to apply a content type called “Order” to a list in my app.

When users click “new item” to upload a document, I want that document to derive from my new content type.

Is it possible to programmatically change the content type order to make this “Order” content type the default one? This can of course be done in the GUI, but I need to do it via script.

SharePoint Apps Getting the GUID of App-Provisioned List using JavaScript and CSOM


I’m a Sharepoint App beginner. I have a SharePoint 2013 App that provisions List. How can I get the GUID of those list using CSOM and JavaScript?

Here’s what I got so far:

    var lists;

    function getLists()
    {
        var context = SP.ClientContext.get_current();
        var web = context.get_web();
        context.load(web, "Title", "Description");
        lists = web.get_lists();
        context.load(lists, "Include(Id, Title, Hidden, ItemCount)");
        context.executeQueryAsync(onSuccess, onFail);
    }

    function onSuccess() {
        var ul = $("#listsList");
        var listsEnum = lists.getEnumerator();
        while (listsEnum.moveNext())
        {
            var list = listsEnum.get_current();
            if (list.get_hidden() == false )
            {                    
                var title = list.get_title();
                var elem = $("<li>" + title + " with GUID " + list.id  + "</li>");
                ul.append(elem); // append the details to a list
            }
        }
    }

    function onFail() {
        alert("Request failed");
    }

The list.id is always undefined. How do I access the GUID property, or am I doing something else wrong?

Thanks!

How do I add a digital signature to an Infopath form in Sharepoint 2013


How to add a digital signature to Infopath form. You need to have a Infopath filler but that is not what resides in SharePoint. Is there a way to add a digital signature line?

How far can I go with SharePoint 2013 Apps?


I am really new to SharePoint 2013 and only worked for a brief period of time in SharePoint 2007 about 5 years ago (so i do not remember much).

I have to plan now an extranet and it will probably be based on SharePoint 2013.

I already read a lot of information about the new Cloud App Model but i cannot figure out how far can I go with Apps.

I understand that apps cannot access Server-Side Object Model. But what does this means in pratical terms?

For example, Our extranet will have a couple of custom sections on a menu accessed and viewed by different types of users. And there is a power user that determines wich persons on his Institution can view which sections.

This is fairly complex as you can see. Can i make an App for this case? or am i accessing user lists that cannot be accessed and this should be a farm solution?

SharePoint Server Throws exception when doing a long operation


I have a SharePoint application with SP server 2010 installed, everything is working well, but there is a special method which is performed in 12 – 14 minutes. What’s done in this method is that i’m requesting a web service to fetch all data (big amount). So what i did is a Thread.sleep(5000), every 5 seconds i check for response.

The problem, is after exactly 10 minutes, i have exception thrown

Category : Error
Level    : Unexpected
Message  : - Message : message additionnel : Configuration problem to access Si
       mulWebservice exception : Thread was being aborted. - Stack Trace : 
         at System.Threading.Thread.SleepInternal(Int32 millisecondsTimeout
       )     at Tegaz.Simul.Web.SPSSiLog.Services.SimulServiceRequest.GetBa
       lancing(Int32 simuId, Int32 userId)



 Category : Error
Level    : Unexpected
Message  : - Message : message additionnel : Error during run balancing button 
           click exception : Thread was being aborted. - Stack Trace :   at Services.SimulServiceRequest.GetBalancing(Int32 simuId, Int32 userId)     at Services.SimulServiceRequest.GetAndOptimBalancing(BalancingFetchingParam fetchingParam, Int32 userId)    at WebParts.Simul
           ZoneVisualWebPart.SimulZoneVisualWebPartUserControl.RunBalancingClic
           k(Object sender, EventArgs e)

At first, i was thinking that it was a problem linked to the web.config or app.config timeout value (but this value is set at 59 minutes).
Then i thought that may be it comes from idle Timeout in the web site app pool, but the Value was set correctly (at 0).
Right now, i have absolutely no idea, what is the reason of this problem. This is very weird, because i’m barely sure that is a configuration problem linked to the IIS server.

Your suggestions are welcome.
Best regards.

Error while deleting keys from SPWebConfigModification


I got following error when I tried to remove item from the WebConfigModification.

Exception calling “Remove” with “1″ argument(s): “Object reference not
set to a n instance of an object.”

I need to remove all the entries from webConfigModification where owner is PowerShell.

$webApp = Get-SPWebApplication "myhomesite.com"
$webApp.WebConfigModifications

**This returns:**

Name                        : add[@key="RedirectToHelloPage"]
Path                        : configuration/appSettings
Sequence                    : 0
Owner                       : PowerShell
Value                       : <add key="RedirectToHelloPage" value="Hello.aspx" />
Type                        : EnsureChildNode
UpgradedPersistedProperties : {}

Name                        : add[@key="IsString"]
Path                        : configuration/appSettings
Sequence                    : 0
Owner                       : PowerShell
Value                       : <add key="IsString" value="false" />
Type                        : EnsureChildNode
UpgradedPersistedProperties : {}

Name                        : add[@key="IsString"]
Path                        : configuration/appSettings
Sequence                    : 0
Owner                       : PowerShell112
Value                       : <add key="IsString" value="false" >
Type                        : EnsureChildNode
UpgradedPersistedProperties : {}

And I want to Remove all entries with Owner = PowerShell

$config = $webApp.WebConfigModifications | Where-Object {$_.Owner -eq "PowerShell"}
$webApp.WebConfigModifications.Remove($config)
$webApp.Update()
$webApp.Parent.ApplyWebConfigModifications()

$config contains:

PS C:> write-host $config
Microsoft.SharePoint.Administration.SPWebConfigModification

But I always get above mentioned error:
Can somebody help?

Question and Answer is proudly powered by WordPress.
Theme "The Fundamentals of Graphic Design" by Arjuna
Icons by FamFamFam