How to get SharePoint 2013 App Part ID (ClientWebPart ID) from the app part through client side script (javascript)?

I have the scenario where I have to create panel that contains list of all app parts (SharePoint-Hosted app) added to the SharePoint 2013 host pages, but within the SharePoint-Hosted app itself meaning that I have to use client side code (javascript). I can get host web page url (trought client script – document.referer) where the app part (ClientWebPart) is added. However I also need the ClientWebPart ID so I can verify (trough the LimitedWebPartManager) that this ClientWebPart exists on the host web page.

Does anyone knows how to get the ClientWebPart ID upon adding the sharepoint 2013 app part (ClientWebPart) on the SharePoint 2013 host web page by using client script (javascript) since I have to get this for my list located in the SharePoint-Hosted app?

Please do not get confused with the addional sharepoint app tokens _WPID_ and _WPQ_ which appear to be different things than the ClientWebPart ID that can be retrieved trough the LimitedWebPartManager.

SharePoint app give web project (host web) access to documents

I have a provider hosted SharePoint 2013 app. In this app I have a custom ribbon action that when clicked goes to the host web (Default.aspx).
On this page I want to create a hash for the selected document in SharePoint with the following code:

Uri FileUri = new Uri(docUrl);
byte[] hashValue;

using (var Client = new WebClient())
     hashValue = SHA256Managed.Create().ComputeHash(Client.OpenRead(FileUri));
Label2.Text = BitConverter.ToString(hashValue).Replace("-", String.Empty);

docUrl is a string containing the url to the document in SharePoint. In AppManifest.xml Web, SiteCollection and List all have FullControl.

When I run this I get the error 403 forbidden. Is this because the host web does not have access to the document? How can it be fixed?

Updating List XML on Office 365

I’m trying to create a lookup column on an Office 365 SharePoint dev site through an app using SPServices but I’m not having any luck.

function createLookupColumn(listGuid) {
    var newField = '<Fields><Method ID="2"><Field type="Lookup" DisplayName="Marketing Plan" Required="FALSE" EnforceUniqueValues="FALSE" List="{'+listGuid+'}" ShowField="Title" UnlimitedLengthInDocumentLibrary="FALSE" Indexed="TRUE" RelationshipDeleteBehavior="Cascade" StaticName="Marketing_x0020_Plan" Name="Marketing_x0200_Plan" ColName="int1" RowOrdinal="0"/></Method></Fields>';
    //var newField = "<Fields><Method ID='1' Cmd='New'><Field Type='Text' DateOnly='TRUE' DisplayName='TESTText' FromBaseType='TRUE'/></Method></Fields>";
        operation: "UpdateList",
        listName: "TestList",
        listProperties: "",
        updateFields: "",
        newFields: newField,
        deleteFields: "",
        listVersion: "",
        async: false,
        completefunc: function (xData, Status) {


The SPServices library is loading b/c the commented out alert fires when uncommented. My listGuid arg isn’t the problem either b/c I’ve tried uploading a basic xml file withouth overwriting the GUID (as noted in the second newField that’s commented out) and that doesn’t go through either. It’s not failing, but it’s just not creating any columns.

I’ve had similar problems as this in the O365 environment utilizing the get_XmlSchema and set_XmlSchema. In fact, I’ve never been able to set an XML on O365 and am really starting to wonder if it’s even possible to overwrite XML in the cloud. What am I missing?

“The server was unable to save the form at this time. Please try again”, when adding new announcement

I have a team site inside my SharePoint 2013. then i have added an Announcement app to the site, but then i try to add a new announcement i am getting the following error :-
The server was unable to save the form at this time. Please try again

And i have added other apps such as calendars and document management to the same team site, and i am able to add items to these Apps without any problem. so can anyone advice on what is the problem with the announcement App?

Sharepoint-moved document is acessible by old link but takes time(up to 3hrs)

After moving a document from one location to other, The old link(link with doc id) is taking some time (up to 3hrs) to work.Could anyone please say,what is reason behind it, or how can i solve this issue?

RefreshToken is null on ItemAdded, works fine on ItemUpdated

I have an EventReceiver that is subscribed to both the ItemAdded and ItemUpdated event on a SharePoint list. I’m using the TokenHelper provided in the sample files, and have also tried the version hosted on NuGet.

In both cases the properties object has all of the IDs and details required to access the list. The ItemUpdated event works fine through the code and gets to the end of the method but the ItemAdded event fails to retrieve a ClientContext (using TokenHelper.CreateRemoteEventReceiverClientContext(properties)) and on further investigation it appears that the SharePointContextToken that the ReadAndValidateContextToken method is generating does not have a refreshToken on it.

Digging a little deeper into the code, it would appear that my JsonWebToken is missing this claim. It only has the following claims: isbrowserhostedapp, appctx (times 2) and appctxsender (times three).

I can’t work out why this is so any help on how to diagnose this would be appreciated.

Sharepoint 2013 single app diffrent sp sites

I want to developp one app for sharepoint 2013. In fact i have a subsite that is created for every new business opportunity and i want every site to communicate with this app.
Do i have to duplicate the app for each site? or they can communicate with only one app, that would be better for maintenance.

I am new to sharepoint developpement.
THanks for help

Custom action send document to different page

I have a SharePoint 2013 provider hosted app. In the app project there is a ribbon custom action that navigates to a page in the web project. When the ribbon custom action is pressed, the selected document (the entire document not just properties) should be send to the .aspx page. On the .aspx page I want to save it in the database. How can i send the entire document to the .aspx page?

<CommandUIHandler Command="Invoke_RibbonCustomAction1ButtonRequest"

This is the code I have but as you can see this will send the properties to the .aspx page and i want to send the entire document.

SharePoint 2013 Branding – Best practice?

What’s best practice to apply branding on publishing sites and team sites in a SharePoint?

What I’m used to is making a custom solution in VS, but now you got the design manager and also have the option to apply branding by an App.

If make an app, is it possible to add pagelayouts, device channels , etc?

How to make a SharePoint 2010 that would, depending on the recording status has changed its color? [on hold]

There HelpDesk system to SharePoint 2010, there are queries on various issues such as what to do when you add a new query it was yellow when the status of the development of red when the status of “done” green?
there is a list with the status: the Work, New, Completed, Closed

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