Add js files to sharepoint page using sharepoint designer
Hi
My self Arun Darly
I want to call my custm.js file on click event of my share point designer page
I placed my "custm.js" in " /_layouts/1033/JS/project/custom.js" and given the reference in the master page as like below
<script type="text/javascript" src="/_layouts/1033/JS/project/custom.js"></script>
but on click event I am not getting the Function() which was i written in the custm.js file
so please help me if any one know how to call that custm.js file to lode the function
Thanks in advance.
Arun Darly
Thanks
Geetanjali Arora for replying me
I tried to call the .js file by using button click event but I am not getting the method and I checked my Custm.js file is not loaded so I placed script in aspx page then only
I am getting that function .
But I want to call my custm.js file on click event of button
Thanks in advance.
Arun Darly
Similar Messages
-
How to add js files to sharepoint page using sharepoint designer
how to add js files to sharepoint page using sharepoint designer
Upload the files to your site collection into the site assets library or into the style library, depending on perference.
Then you can include the JS files either in the master page, page tempalte or using web parts. -
Add datetime property to "MetaInfo" field using SharePoint 2013 CSOM
When uploading a file along with metadata using SharePoint FP RPC (using the "method= put document") it allows me to properly add datetime properties. My metainfo looks like this:
"MetaInfo":"...MyCustomDate:TW|05 Jan 2015 12:58:31 -0000\r\n..."
Then later on, when I try to update "MyCustomDate" property from the "MetaInfo" field using CSOM, it fails while updating it. (In this case I am using CSOM because I am updating some more fields and I want to avoid extra round-trips)
After that update my metainfo looks like this:
"MetaInfo":"...MyCustomDate:FX|0x01d028e7|0x4d1c4880\r\n..."
Does anyone know why?, is there any workaround?
ThanksHi,
If you want to add datetime property to "MetaInfo" field using SharePoint 2013 CSOM, the following code snippet for your reference:
using (ClientContext context = new ClientContext("http://yourserver/"))
context.Credentials = new NetworkCredential("user", "password", "domain");
List list = context.Web.Lists.GetByTitle("Documents");
ListItem oListItem = list.GetItemById(1);
oListItem["MetaInfo"] = "MyCustomDate:TW|08 Jan 2015 12:58:31 -0000";
oListItem.Update();
context.ExecuteQuery();
Best Regards
Dennis Guo
TechNet Community Support -
Create Custom Application Page using SharePoint designer
Hi All,
I have a task to create the Custom Application page using SharePoint designer.Can any one help me how can I do this.Can any one help me how can I achieve this
SamarHi Samar,
By application page do you mean writing C# code from SP designer? If so as far as I know you can't write C# code from designer, you have to use Visual Studio for it.
But if you only want an aspx page with some JS code you can create one from "all files" in designer. you will see files menü on ribbon from where you can create aspx page.
Best regards,
Mustafa Yılmaz
Best Regards, Mustafa Yılmaz MCITP, MCPD | www.mustafa-yilmaz.org | www.sharepointciyiz.biz -
How to get all previous versions page contents and other field values of a publishing page using SharePoint Client Object Model 2010?
Thanks,
OsmitaHi Osmita,
Greetings.
Here are the links that helps you. It has code attached to it.
http://social.technet.microsoft.com/Forums/sharepoint/en-US/a0d2ab40-99ba-4368-8505-1dc559ef6469/get-content-of-previous-version-of-page-sharepoint-2010?forum=sharepointgeneralprevious
http://social.technet.microsoft.com/Forums/sharepoint/en-US/faaf419f-997e-4150-9911-48cc375c3b46/how-to-get-previous-published-versions-of-publishing-pages-in-sharepoint-2010?forum=sharepointdevelopmentprevious
Please remember to click 'Mark as Answer' on the answer if it helps you -
Unable to add XML files to genericObjects Folders using Webdav - cFolders
Hi All
I am not able to add XML files to genericObjects Folders using Webdav in cFolders
What could be the reason.. When I try to copy, it says "cant read from source file"
Regards,
AbyYes.. I downloaded the ECN.XML file from se80, edited and then used "Uplload and replace"..
Also I did the same thing to add some more vocabulary in the cfx text XML, so that it would reflect correctly to map with Additional attributes in the PDX profile.
Regards,
Aby -
Can we customize any other expect SharePoint Sites using Sharepoint Designer
Hi All,
Can we customize any other expect SharePoint Sites using Sharepoint Designer?
Thanks in Advance!As Hemmendra, the tool is specifically designed for SharePoint. Both this and another tool derive from an older utility called FrontPage, which was an early Web Authoring product, before the age of standards and the like.
The other product that evolved into a paid development tool but is now free is one called Expression Web. This can do more web specific stuff and may be of use for you. It was made a free product a year ago though and can be found here.
http://www.microsoft.com/en-gb/download/details.aspx?id=36179
What else were you looking to achieve?
Steven Andrews
SharePoint Business Analyst: LiveNation Entertainment
Blog: baron72.wordpress.com
Twitter: Follow @backpackerd00d
My Wiki Articles:
CodePlex Corner Series
Please remember to mark your question as "answered" if this solves (or helps) your problem. -
How does one add tables to an existing universe using COM designer SDK.
Morning All
How does one add tables to an existing universe using COM designer SDK. I have tried:
objUniverse.Tables.Add (strTable_Name)
but get "Cannot create Table" error.
Any ideas?
Thanks in advance.
AnitaHi Anita,
-Use the Add method to add classes and objects to an existing universe using a VB 6 application.
Adding a Class
Definition: Function Add(Name As String) As Class
Syntax: NameOfClassesVariable.Add
Adding an Object Instance
Definition: Function Add(Name As String, [ClassName As String]) As Object
Syntax: NameOfObjectsVariable.Add(name, [class])
- name is the name of the object.
- class is the name of the class containing the object. This parameter should be used in cases where more than one objects exist with the same name.
Sample Visual Basic 6 Code
Dim DesApp As Designer.Application
'MODIFY AND EXPORT CLASSES AND OBJECTS OF AN EXISTING UNIVERSE
Sub modify_and_export_universe()
Dim DesUnv As Designer.Universe
Dim DesCls As Designer.Class
Dim DesObj As Designer.Object
Dim DesDBCol As Designer.DBColumn
Dim DBColName As String
Set DesApp = New Designer.Application
'Login to designer
Call DesApp.LogonDialog
'Make sure to log on with your administrator profile
'e.g : "hostname","username", "password","Enterprise"
'Make Designer application visible
DesApp.Visible = True
'This line disable warning messages from Designer
DesApp.Interactive = False
'to Open locally the universe you want to modify
'Set DesUnv = DesApp.Universes.Open("club_uni")
'Use OpenFromEnterprise method (Universes Class) to import a universe from the repository and opens it
Set DesUnv = DesApp.Universes.OpenFromEnterprise("Universes", "club_uni", False)
'Add a valid connection which already exists
DesUnv.Connection = "club"
'open the universe
'Call DesApp.Universes.Open("club_universe")
'Add the table Account and refresh the view in the main window
Set DesTab = DesUnv.DBTables.Item("Customer").Insert
DesUnv.ArrangeTables
'Add a class
Set DesCls = DesUnv.Classes.Add("Class MyCustomer")
'Looping through all the fields of the DB Table Account
For Each DesDBCol In DesUnv.DBTables.Item("Customer").DBColumns
'Store name of the column
DBColName = DesDBCol.Name
'Add an object to the class
Set DesObj = DesCls.Objects.Add("Obj " & DBColName)
'Affect a field to the object
DesObj.Select = "Customer" & "." & DBColName
Next
'Save the existing universe with the same name club_uni or you can change
DesUnv.SaveAs "club_uni"
MsgBox "Universe created and saved Class MyCustomer has been added!!"
'Close the universe
UnvFullName = DesUnv.FullName
MsgBox "The UniverseFilePath is " & UnvFullName
'Close the universe
DesUnv.Close
'This line disable warning messages from Designer
DesApp.Interactive = False
'Export the universe to the CMS DB (to the last universe folder)
'Make sure you save the universe before exporting it
Call DesApp.Universes.Export("Universes", UnvFullName)
MsgBox "This document has been exported successfully !!"
'Close designer
DesApp.Quit
Set DesApp = Nothing
End Sub
Hope this helps.
Regards,
Deepti Bajpai -
Insert webpart zone in tabs in webpart page using sharepoint designer 2010
Hi All,
I am facing a problem , its looks very easy but i couldn't found any clue about this.
i have created a webpart page, after this i have enable to view quick launch in this webpart page. then i have create a some tabs with reference to this site
https://jqueryui.com/tabs/. but the problem is when i go to view my page in browser it take same height which is same as quick launch height. and in my diff scenario i have created tab using content editor web part then its working fine. but
i need to create web part zone in these tabs that why i m not able to do this using content editor. so i am using designer only.
i guess i am writing content in wrong content place holder or etc. please help me ...i have already lost my 2 days for this.
FYI, please find the code which i used in webpart page using share point desinger.
<asp:Content ContentPlaceHolderId="PlaceHolderPageTitle" runat="server">
<SharePoint:ListItemProperty Property="BaseName" maxlength="40" runat="server"/>
</asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderPageTitleInTitleArea" runat="server">
<WebPartPages:WebPartZone runat="server" title="loc:TitleBar" id="TitleBar" AllowLayoutChange="false" AllowPersonalization="false"><ZoneTemplate>
<WebPartPages:TitleBarWebPart runat="server" AllowEdit="True" AllowConnect="True" ConnectionID="00000000-0000-0000-0000-000000000000" Title="Web Part Page Title Bar" IsIncluded="True" Dir="Default"
IsVisible="True" AllowMinimize="False" ExportControlledProperties="True" ZoneID="TitleBar" ID="g_14e08bcc_e32c_4759_80dc_34e124e6212f" HeaderTitle="abc1" AllowClose="False" FrameState="Normal"
ExportMode="All" AllowRemove="False" AllowHide="True" SuppressWebPartChrome="False" DetailLink="" ChromeType="None" HelpLink="" MissingAssembly="Cannot import this Web Part." PartImageSmall=""
HelpMode="Modeless" FrameType="None" AllowZoneChange="True" PartOrder="2" Description="" PartImageLarge="" IsIncludedFilter="" __MarkupType="vsattributemarkup" __WebPartId="{14E08BCC-E32C-4759-80DC-34E124E6212F}"
WebPart="true" Height="" Width=""></WebPartPages:TitleBarWebPart>
</ZoneTemplate></WebPartPages:WebPartZone>
</asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderTitleAreaClass" runat="server">
<style type="text/css">
Div.ms-titleareaframe {
height: 100%;
.ms-pagetitleareaframe table {
background: none;
</style>
</asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderAdditionalPageHead" runat="server">
<meta name="GENERATOR" content="Microsoft SharePoint" />
<meta name="ProgId" content="SharePoint.WebPartPage.Document" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="CollaborationServer" content="SharePoint Team Web Site" />
<script type="text/javascript">
// <![CDATA[
var navBarHelpOverrideKey = "WSSEndUser";
// ]]>
</script>
<%--<SharePoint:UIVersionedContent ID="WebPartPageHideQLStyles" UIVersion="4" runat="server">
<ContentTemplate>
<style type="text/css">
body #s4-leftpanel {
display:none;
.s4-ca {
margin-
</style>
</ContentTemplate>
</SharePoint:UIVersionedContent>--%></asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderSearchArea" runat="server">
<SharePoint:DelegateControl runat="server"
ControlId="SmallSearchInputBox"/>
</asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderLeftActions" runat="server">
</asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderPageDescription" runat="server">
<SharePoint:ProjectProperty Property="Description" runat="server"/>
</asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderBodyRightMargin" runat="server">
<div height="100%" class="ms-pagemargin"><img src="/_layouts/images/blank.gif" width="10" height="1" alt="" /></div>
</asp:Content>
<%--<asp:Content ContentPlaceHolderId="PlaceHolderPageImage" runat="server"></asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderNavSpacer" runat="server"></asp:Content>--%>
<%--<asp:Content ContentPlaceHolderId="PlaceHolderLeftNavBar" runat="server"></asp:Content>--%>
<asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server">
<html lang="en">
<head>
<meta name="WebPartPageExpansion" content="full" />
<meta charset="utf-8">
<title>jQuery UI Tabs - Default functionality</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css">
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css"><script>
$(function() {
$( "#tabs" ).tabs();
</script></head><body><div id="tabs">
<ul>
<li><a href="#tabs-1">Bangalore 1</a></li>
<li><a href="#tabs-2">Bangalore 2</a></li>
<li><a href="#tabs-3">Bangalore</a></li>
<li><a href="#tabs-4">Chennai 4</a></li>
</ul>
<table cellpadding="4" cellspacing="0" border="0" width="100%">
<tr>
<td><div id="tabs-1"> <%--id="_invisibleIfEmpty" name="_invisibleIfEmpty" valign="top" width="100%"> --%><WebPartPages:WebPartZone id="g_6958510ECBD74ABD8AA9F8E26B747B27"
runat="server" title="Zone 13"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone><WebPartPages:WebPartZone id="g_FA3DDD09582A4C589559877B7169340D" runat="server" title="Zone 14"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone></div></td>
</tr>
<tr><td><div id="tabs-2">
<WebPartPages:WebPartZone id="g_73928F4B9F484EE392EBCBA7D5ACF9FE" runat="server" title="Zone 1"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone>
<WebPartPages:WebPartZone id="g_77B2328C81874FFB8034559174B450BF" runat="server" title="Zone 12"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone>
</div></td></tr>
Please help..if u need any other detail i ll provide you.. plz check the image after doing this the tabs take full range as quick launch.
Thanks
Vivek Singh TomarYou do not need to work on visual studio, you can create page layout form web and sharepoint designer. Page layouts are only available on publishing sites, you can modify page layout using sharepoint designer, add your required html and web part zones.
Check below few links for reference:
http://msdn.microsoft.com/en-us/library/gg430141(v=office.14).aspx#bk_custompagelayout
http://www.mssharepointtips.com/tip.asp?id=1125
http://blogs.technet.com/b/tothesharepoint/archive/2013/04/10/stage-7-upload-page-layouts-and-create-new-pages-in-a-publishing-site.aspx
http://msdn.microsoft.com/en-us/library/gg430141(v=office.14).aspx#bk_custompagelayout
Page layouts creation and editing is almost same in MOSS 2007, SharePoint 2010 and SharePoint 2013. If you are creating page layout using web then you can easily modify it using SharePoint designer.
Adnan Amin MCT, SharePoint Architect | If you find this post useful kindly please mark it as an answer :) -
Copying SharePoint Page between SharePoint Sites with the MasterPage and Correct PageLayout
Hi All,
I have created a page in the following SharePoint Site Using a Custom SharePoint MasterPage and a Custom PageLayout.
https://devrussellportal.prod.ds.russell.com/sites/emeasandbox/Data-Governance/Pages/DataGovernanceHome.aspx
In this site I have a Page called 'DataGovernanceHome.aspx' in that site. I need to copy this page with the MasterPage and the PageLayout that I have used to build this Site Page to https://russellportal.prod.ds.russell.com/sites/datagovernance/ Site.
I was able to copy the MasterPage with all styles and images without any errors and applied successfully to the new site. I exported the desired page from the old SharePoint Site and imported to the new SharePoint Site via SPD. But when I tried to open the
page it gave me an error 'Sorry, something went wrong'.
I even edit the
<mso:PublishingPageLayout msdt:dt="string">https://russellportal.prod.ds.russell.com/sites/datagovernance/_catalogs/Russell SharePoint 3 Column.aspx, Russell SharePoint 3 Column </mso:PublishingPageLayout>
tag by updating the new SharePoint Site URL also. But did not solve the matter. So what is I am missing in here? Could someone help me to solve this matter?
Thanks and regards,
ChiranthakaHi,
Having moved the Master Page, Page Layout and other supporting branding assets successfully is a great first step.
So now you are attempting to move the content page. The content page itself is really a list item in the pages library. The aspects of a given content page are simply stored in site columns. When you copy the content page from one library to another using
SPD, I do not believe everything will transfer.
What you could try next is to open your source site in SPD. Navigate to the pages library and then detach your specific content page from its page layout (right click the content page to see this option). Now open this page in SPD to see all content.
Do the same thing in your destination site. First create a new content page in your destination site, then open SPD. Detach this content page from its page layout and now copy and paste the contents from source to destination. Save and see if the destination
content page loads. If it does, try reattaching the page layout on the destination site. As you noticed before, you may need to change a mso property to the new page layout location.
Another hiccup could be the specific web parts you added to the content page, but I can't say for sure. Possibly a webpart is attempting to access data it does not have access to?
All else fails, can you simply recreate the content page on the destination site from scratch, then copy content and add web parts in to effectively recreate the page by hand?
Eric Overfield - PixelMill -
ericoverfield.com -
@EricOverfield -
How to add a file in Document Set using ECMA script?
Hi,
I want to upload a particular file into Document set using ECMA script.
I can do it easily through C# but unable to achieve the same using ECMA Script.
Any pointers or piece of code will be helpful.
Thanx in advance :)
"The Only Way To Get Smarter Is By Playing A Smarter Opponent"The following blog post provides a way to create a document set using ECMA:
http://blogs.msdn.com/b/mittals/archive/2013/04/03/how-to-create-a-document-set-in-sharepoint-2013-using-javascript-client-side-object-model-jsom.aspx
The following blog post provides a way to upload files into a document set using CSOM:
http://www.c-sharpcorner.com/Blogs/12139/how-to-create-document-set-using-csom-in-sharepoint-2013.aspx
See if you can follow the logic in the CSOM example to apply it to ECMA. Let me know if you have specific problems with it.
Dimitri Ayrapetov (MCSE: SharePoint) -
How to embed jnlp file into html page using object tag
hi everyone,
i have written one jnlp file like this.
<?xml version="1.0" encoding="utf-8" ?>
<!-- JNLP file for Demo applicaion -->
<jnlp spec="1.0+" codebase="http://localhost:9080/base/" href="SampleExample.jnlp">
<information>
<title>Demo Application</title>
<vendor> </vendor>
<description>Sample Demo Application</description>
<offline-allowed/>
</information>
<security/>
<resources>
<j2se version="1.3+" />
<jar href="common.jar" main="true" download="eager" />
<jar href="classes12.jar" download="eager" />
<jar href="toplink.jar" download="eager"/>
<package name="com.applet.*" part="applet" recursive="true"/>
</resources>
<applet-desc name="grid" main-class="com.applet.PriceGrid" width="1000" height="300"/>
</jnlp>
i am trying embed that jnlp file using object tag like
<OBJECT
classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" WIDTH="1000" HEIGHT="300" NAME="grid">
<PARAM NAME="jnlp" VALUE="http://localhost:9080/base/SampleExample.jnlp">
</OBJECT>
but i am not able to load the applet using Web Start.
Can anyone please help me. This is very Urgent for me.
Thanks & Regards,
Shiva.thanks.
i am giving my problem clearly. i have one applet. Previously i am loading the applet in my html page using object tag like this...
<OBJECT
classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" WIDTH="1000" HEIGHT="300" NAME="grid">
<PARAM NAME="CODE" VALUE="com.adp.base.applet.PriceGrid.class" >
<PARAM NAME="ARCHIVE" VALUE="common.jar,classes12.jar,toplink.jar" >
<PARAM NAME="NAME" VALUE="grid" >
<PARAM NAME="type" VALUE="application/x-java-applet">
<PARAM NAME= "cache_option" VALUE ="no">
</OBJECT>
now what i need to do is
i need load the applet only first time using web start and when ever the applet code changes in the server i need to reload the applet.
for that i kept all the applet resources in .jnlp file.i want to cache all the resources which are in .jnlp file and applet must be displayed within a web page within a browser.
Webstart always open a new application windows.
I need to run an Applet embedded within a web page within a browser.
Is there a way to still use Webstart? -
Problem with opening PDF files from JSF page using SDO
Hi all,
I'm new with JSF and was attempting to read a PDF file from a Database using SDO and JSF. The code below throws an exception when casting from DataObject to Blob. The getLcDoc() method was created by WSAD when I dragged an SDO relational record onto the JSF page. This method returns an DataObject type which I tried casting to a Blob type before using it further. However, an exception is thrown.
Any feedback is appreciated.
Arv
try {
FacesContext faces = FacesContext.getCurrentInstance();
HttpServletResponse response =(HttpServletResponse) faces.getExternalContext().getResponse();
Blob file= (Blob)getLcDoc().get("ATTACH");
int iLength = (int)(file.length());
response.setHeader("Content-type", "application/pdf");
response.setHeader("Content-Disposition", "inline; filename=Attachment");
response.setHeader("Expires","0");
response.setHeader("Cache-Control","must-revalidate, post-check=0, pre-check=0");
response.setHeader("Pragma","public");
response.setContentLength(iLength);
ServletOutputStream os = response.getOutputStream();
InputStream in = null;
in = file.getBinaryStream();
byte buff[] = new byte[1024];
while (true) {
int i = in.read(buff);
if (i<0) break;
os.write(buff,0,i);
os.flush();
os.close();
} catch(Exception ex){
System.out.println("Error while reading file : " + ex.getMessage());
}Hi...I found out that there is actually no need to use a Blob object at all. You can simply call the OutputStreams write() method and pass the DataObject.getBytes() method that returns a byte[] array. The revised code is shown at the end of this posting.
However, a few other teething problems exist:
1. This works well only if I specify the content type in response.setHeader() method. What if my users upload different types of files, is there a way that the browser opens according to the file type without setting the content type?
2. I still have a problem opening PDF files, even if I specify - response.setHeader("Content-type", "application/pdf");
I get the message - The file is damaged and could not be repaired
3. I would also like this to open the attachment in a new window and using target="_blank" doesn't seem to work as seen below:
<h:commandLink
styleClass="commandLink" id="link1" action="#{pc_DocumentDetailsRead.doLink1Action}" target="_blank">
<h:outputText id="text5" styleClass="outputText"
value="Click Here"></h:outputText>
</h:commandLink>
------------------------Revised code-----------------------------------------
FacesContext faces = FacesContext.getCurrentInstance();
HttpServletResponse response =(HttpServletResponse) faces.getExternalContext().getResponse();
response.setHeader("Content-type", "application/msword");
response.setHeader("Content-Disposition", "inline; filename=Attachment");
response.setHeader("Expires","0");
response.setHeader("Cache-Control","must-revalidate, post-check=0, pre-check=0");
response.setHeader("Pragma","public");
ServletOutputStream os = response.getOutputStream();
os.write(getLcDoc().getBytes("ATTACH"));
os.flush();
os.close(); -
Add text in any working page using script
Hi there,
I am writing a script which creates a text frame and adds text in it. The problem is, I want to add some information below everytime on many documents. Instead of copying from other sources everytime, I thought of writing a scirpt which by clicking creates a text frame and puts text in that because it is the same for all. Now two issues:
1) It is coming but in the first page. I need that in the working page, for example clicking that it should come in page 2 or 4 and not in the first page.
2) The text has a word should be in quotes giving like that the script shows error. My example code is given below:
var myDocument = app.activeDocument;
var myTextFrame = myDocument.textFrames.add()
myTextFrame.geometricBounds = ["11.2in", "8in","10.99in","0.5in"];
myTextFrame.contents = "This is a "sample" text.
Please try without quotes first. Without quotes for sample word it is coming in the first page. With quotes it shows error.
What is the solution. 1) need to add on the current working page. 2) should also include a word within quotes.
Help really appreciated!Hey Rohan,
It did worked. GREAT.
If you can give the solution for the second one, i.e. getting the text within the quotes, that will be a great help.
As You and Ken said, I sent this to the scripting forum too. But as you have already got the first one, had a hope that you might get the other too.
Thanks -
Unable to add aspx file to document library using REST and JSOM in SharePoint Hosted App
Hi,
I am unable to add an aspx file to document library. I was actually trying to create a WIKI page and upload to Pages library but that wasn't working so I tried simple document library. It keeps failing with Access Denied error. I have checked
the blocked types and aspx is not included. I can upload it directly from the browser so that shouldn't be the case. I have read that it can be achieved with CSOM but I need this to work with a SharePoint Hosted App. Here is my JSOM:
factory = new SP.ProxyWebRequestExecutorFactory(appweburl);
context.set_webRequestExecutorFactory(factory);
appContextSite = new SP.AppContextSite(context, hostweburl);
oWeb = appContextSite.get_web();
oList = oWeb.get_lists().getByTitle('Documents');
fileCreateInfo = new SP.FileCreationInformation();
fileCreateInfo.set_url("mywiki.aspx");
fileCreateInfo.set_content(new SP.Base64EncodedByteArray());
fileContent = "<%@ Page Inherits=\"Microsoft.SharePoint.Publishing.TemplateRedirectionPage,Microsoft.SharePoint.Publishing,Version=15.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c\" %> <%@ Reference VirtualPath=\"~TemplatePageUrl\"
%> <%@ Reference VirtualPath=\"~masterurl/custom.master\" %>";
for (var i = 0; i < fileContent.length; i++) {
fileCreateInfo.get_content().append(fileContent.charCodeAt(i));
newFile = oList.get_rootFolder().get_files().add(fileCreateInfo);
context.load(newFile);
context.executeQueryAsync(function () {
alert('yo');
}, function (sender, args) {
alert(args.get_message() + '\n' + args.get_stackTrace());
If I change the file extension to "txt", it works. Same with REST implementation, it works with "txt" but fails with "aspx". Maybe what I am trying to do will not work using JSOM or REST. Any suggestions? Your
help is always appreciated.
Regards,
kashifYour code works fine in both my on-premises and SharePoint Online. I have given the app full control, so I suspect this is a permissions issue. I would check your permissions on your appmanifest. Must be something to do with publishing permissions. Try
giving full control and work the permissions down.
Blog | SharePoint Field Notes Dev Tools |
SPFastDeploy | SPRemoteAPIExplorer
Maybe you are looking for
-
How do i add a protocol in firefox 4.0?
I need to add the byond:// protocol to firefox 4.0 so i can download BYOND software
-
Rename Constant outgrp attribute in OMBPlus
Does anyone know the OMBPlus syntax to RENAME an ATTRIBUTE of OUTGRP1 of a CONSTANT Operator? Thank you,
-
Enhanced Podcast Artwork missing in Quicktime
I created a number of enhanced podcasts using Garageband 09. All of them display the podcast track (artwork) just fine in iTunes. Only some of them display correctly in QuickTime. I was using QT to export them as 3gp files, but some of them show audi
-
When setting up sync how does sync manage information from two computers? Does it merge the information?
-
Safari 8 error: "...you need to install the Java Runtime Environment"
Ever since upgrading to Yosemite and Safari 8, I continually get the error "To view this web content, you need to install the Java Runtime Environment" and, although I did do so the first time I got the error, and Java tells me I do have the latest v