I'm trying to send an automatic email receipt for items that have been created on a sharepoint list.
Conditions
I cannot use workflows - they are disabled
I cannot use webparts - they are disabled
I cannot use sharepoint designer etc etc etc - they are all disabled
The function needs to be OOTB
The only option I have is using javascript in calculated columns. I am aware of the use of the HTML:mailto tag - but this opens Microsoft outlook, and is not automatic.
Came across this link:
http://geekswithblogs.net/ThorvaldBoe/archive/2014/07/03/sending-email-with-sharepoint-and-jquery.aspx
So, here is the calculated column attempt:
="<button onclick=""{function SendEMail(from, to, body, subject){"
&"var siteurl = _spPageContextInfo.webServerRelativeUrl;"
&"var urlTemplate = siteurl + '/_api/SP.Utilities.Utility.SendEmail';"
&"$.ajax({"
&"contentType: 'application/json',"
&"url: urlTemplate,"
&" type: 'POST',"
&"data: JSON.stringify({"
&"'properties': {"
&"'__metadata': { 'type': 'SP.Utilities.EmailProperties' },"
&"'From': from,"
&"'To': { 'results': [to] },"
&"'Body': body,"
&"'Subject': subject"
&"}}),"
&"headers: {"
&"'Accept': 'application/json;odata=verbose',"
&"'content-type': 'application/json;odata=verbose',"
&"'X-RequestDigest': $('#__REQUESTDIGEST').val()"
&"},success: function (data) {"
&"alert('Eposten ble sendt');"
&"},error: function (err) {"
&" alert(err.responseText);"
&" debugger;}});}"
&"SendEMail('user#whatever.com','user#whatever.com','Test1','Test2');}"">"&"Send</button>"
When running the code, the Console shows the following error: '$' is undefined
Any suggestions on how to overcome this?
Thanks
You keep raising the bar, Steve!
You're really making it difficult for yourself this way
I suggest the next learning steps first:
Learn all about Chrome Snippets
this will help you develop/execute code directly on the View page without the need for stuffing it in a Calculated Column or any script in SharePoint
Learn jQuery (by using Snippets)
check out jQuerify it will inject jQuery where it is not available
[optional] Learn Tampermonkey
this will help in immediatly executing your scripts on a SharePoint page (without the need for including the script in SharePoint
Learn JSOM Ajax calls and REST Ajax calls (REST is halfbaked implemented in 2010)
again; do them in Snippets first
When that all works you're halfway done and you can wrap it all in the Calculated Column (again, this is all undocumented hacking away at Microsoft technology, if they decide to make changes in an Update you're cooked... e.g they disabled the use of the SCRIPT tag in summer 2013; that's why you now have to use the blank IMG onload trick
Note: I have updated my CalcMaster BookMarklet on GitHub. Once you have your Snippet working you can paste it in an existing Calculated Column Formula and wrap it in IMG onload and &".." notation with one click
If you get that sending email working let us know; I have never done it... I stay away from projects where SharePoint Designer can not be used.
Once you have mastered all the above you will have learned so much Front-End development I suggest you go look for another job.
Related
I'm planning on trying to see if it's possible to make a website in Godot(Yes, I know I shouldn't I just want to try just to try). I thinking about and looking over the features I need and I have one problem.
I just need a way for a person to press a button and get redirected to my itch games. I don't care if it creates a new tab or changes the current tab. Thank you for any help.
If you dont export to web you can call
OS.shell_open("url")
Sadly this does not work in an html export. A solution I found for myself is the JavaScript Interface. As the name suggested it allows you to execute Javascript.
So to open a URL you could connect the pressed signal of a button to something like this:
if OS.has_feature('JavaScript'):
JavaScript.eval("""
window.open('https://google.com', '_blank').focus();
""")
This will open a new tab in the active browser.
I also found an article on the godot site, basically asking the same question (https://godotengine.org/qa/46978/how-do-i-open-richtextlabel-bbcode-links-in-an-html5-export). Here they tried to use an RichTextLabel with BBCode.
The solution did not work for me, when I tested it, though.
As pointed in the comments you can try OS.shell_open, for example:
OS.shell_open("https://example.com")
That only works if it is not an HTML export.
Your other alternative is to eval JavaScript, for example this navigates the current tab:
JavaScript.eval("window.location.href='https://example.com'")
Which only works if it is an HTML export.
Since that only works for an HTML export and the other does not work on an HTML export... If you need both you can do this:
if OS.get_name() == "HTML5":
JavaScript.eval("window.location.href='https://example.com'")
else:
OS.shell_open("https://example.com")
See also Close a game in Godot.
I need to embed PDF files in an xpage application. We are using IE11 x64 and this cannot be changed. Eventually, I'll also need to embed MS Office files (Word, Excel, Power Point).
I have looked at a lot of pages and couldn't get a working solution for this... I have some code that works if I force IE11 in IE10 mode, but then Dojo starts acting weird (cannot close dialog boxes, ...).
The code I have right now in my computed field looks like this:
var id:string = pageDocument.getDocument().getUniversalID();
var attNames = #AttachmentNames();
var url = getAttachmentURL(id,attNames);
'<object data="' + url + '#view=Fit&pagemode=none&statusbar=0&messages=0"' +
'type="application/pdf" width="100%" height="100%" > ' +
'<p>It appears your Web browser is not configured to display PDF files. ' +
'No worries, just click here to download the file.</p>'+
'</object>'
I need a free solution.
IBM, This should be made easy if we want to compete with SharePoint, no???
Short answer: don't bother.
Long answer: While you might get it to work for PDF in IE11, your boss won't be happy, because it will not show on her iPad, so you need to have a plan B.... and there is another gotcha down the road (read below). This is what I would do:
Use Apache PDFBbox to extract text from the PDF and show that in the XPage.
Add a link to the page to open the whole PDF
Do the same thing for office documents using Apache POI eventually using OpenNTF POI4XPages
The download link should make use of WebDAV for Domino to allow round-trip editing
Why all this fuzz:
Your users will use mobile at some point of time and NO mobile browser does support embedding (nor do any browsers on a Mac)
Even if you successfully get embedding working, users will start to edit the embedded document and get really really upset since you don't save back the changes
On a side note: asking IBM to support a technology that is vendor proprietary working in one browser (that has been EOL for future updates - see project Spartan) - ain't going to happen.
I got this working nicely in IE11 for PDF files with this very simple line:
<embed src="MyPDFFile.pdf" width="640px" height="755px" alt="pdf" />
I'll go along with Stephen's answer: I won't bothe rtrying to mak ethis work with Office files. It will give our "Notes is bad" users some munitions to move to SharePoint, but we do have other advantages!
I tried using Bumpbox, and pdf.js and while I could get them working, iframes seemed to work best for me with using normal Domino attachment urls in xpages
I am not sure if this solution is right or not, but it works well for an app I have that only has PDFs. It does work on mobile too, at least on iOS.
<iframe
src="#{javascript:
var url = 'https://app.nsf/';
var doc = sessionScope.docID;
var atname = #RightBack(sessionScope.aname,'Body');
var end = '/$file'+atname;
return url+doc+end}"
width="800" height="1000">
</iframe>
Probably the best approach is to use a pure HTML5/JavaScript renderer
for PDF documents without any third-party plugins (e.g. PDF.js)
For further discussion take a look at the following stackoverflow
entry recommended way to embed pdf in html
In my opinion, it's the best way to use a commercial product (e.g. crocodoc) for other documents like MS Office (Word, Excel, etc.).
I am looking at the default master page in SharePoint 2013 (v15.master) and there is a server control there <SharePoint:SuiteBarBrandingElement runat="server"/> which on the page renders as 'SharePoint'. I can't figure out where to change it to something else (without writing code behind).
Information is thin, but there does not appear to be any UI-based way to get at this setting. But a setting it is (actually, a property on SPWebApplication).
Refer to this (unhelpful) documentation: SPWebApplication.SuiteBarBrandingElementHtml
Like you point out, you could write a solution to modify this property, but we can also use some PowerShell to get at it.
Executing this in the SharePoint 2013 Management Shell:
$app = Get-SPWebApplication http://my.sp2013.site/
$app.SuiteBarBrandingElementHtml
Yields this output:
<div class="ms-core-brandingText">SharePoint</div>
This means that we can just assign a new value here:
$app.SuiteBarBrandingElementHtml = '<div class="ms-core-brandingText">Hello World!</div>'
$app.Update()
That aside, it would be pretty handy to build a solution that exposed the property via the Admin UI to update it. I don't know why Microsoft didn't provide this out of the box; it seems like that was the intention (at some point).
I have a report that contains a link to a Word document. I have created an Action on the textbox that is Jump to URL, with the URL populated.
I have a PerformancePoint dashboard displaying the report, which is in a report library using SharePoint Integrated reports.
The link is not working correctly. Following the recommendations of this guy I surrounded my link w/ the javascript to open in a new window.
This works everywhere except for the end result. The link works from BIDS, Dashboard Designer, and the Report Library. It does not work from within the dashboard deployed to the SharePoint site. Any ideas?
Edit:
This HTML link:
=First(Fields!Link.Value, "MyUrl")
gives me this in the rendered report:
<TD style="WIDTH:53.98mm;word-wrap:break-word;HEIGHT:6.35mm;" class="a7">Click Me!</TD>
This Javascript link:
="javascript:window.location.href='" & First(Fields!Link.Value, "MyUrl") & "';"
gives me this in the rendered report:
<a tabindex="40" href="javascript:window.location.href='http://example.com/sites/some/subsite/DocumentLibrary/Folder/MyDocument.doc';" style="color:Blue" TARGET="_top">Click Me!</a>
Which does nothing when you click it.
I'm not familiar with Performancepoint, but the way you write the javascript seems like you simplified it a bit? I'm asking because the only way that perfectly fine link would not work would be if the page has a return false for the links in it. Try moving the whole changing the URL into a function, like:
<script type='text/javascript'>
function goTo(url) {
window.event.stopPropagation(); // cancelBubble() in IE
location.href = url;
return false;
}
</script>
with the link being:
="javascript:goTo('" & First(Fields!Link.Value, "MyUrl") & "')"
and do some trial and error inside the goTo function, sorry not being able to help you more precisely. Try also testing in a second browser (if you are not already) to see if this is some browser-specific behavior.
It turns out that there were two issues going on.
My first attempt at rendering a link using https://example.com/... didn't work because Reporting Services 2005 refuses to link to https web sites. (no source for this info, just determined through experimentation)
My second attempt at putting javascript around the link failed because PerformancePoint 2007 dashboards don't execute JavaScript from a report. (no source for this info, just determined through experimentation)
The solution was to go back to a straight HTML solution, and use http. This gets redirected to https and the document loads. This solution may not work if your environment does not automatically redirect http --> https.
I didn't mention the https in my original question because I didn't realize that would make a difference.
Is there a way to dynamically change the hyperlink associated with an ECB menu in WSS 3.0? For instance, I have a list with 2 fields. One field is hidden and is a link, the other is the title field which has the ECB menu. The title field currently links to the item's view page - but we want it to link to the link-field's url. Is that possible?
UPDATE - 5/29/09 9AM
I have this so far. See this TechNet post.
<script type="text/javascript">
var url = 'GoTo.aspx?ListTitle='+ctx.ListTitle;
url += '&ListName='+ctx.listName;
url += '&ListTemplate='+ctx.listTemplate;
url += '&listBaseType='+ctx.listBaseType;
url += '&view='+ctx.view;
url += '&';
var a = document.getElementsByTagName('a');
for(i=0;i<=a.length -1;i++)
{
a[i].href=a[i].href.replace('DispForm.aspx?',url);
}
</script>
This gives me a link like so (formatted so it's easier to see):
GoTo.aspx
?ListTitle=MyList
&ListName={082BB11C-1941-4906-AAE9-5F2EBFBF052B}
&ListTemplate=100
&listBaseType=0
&view={9ABE2B07-2B47-4390-9969-258F00E0812C}
&ID=1
My issue now is that the row in the grid gives each item the ID property above but if I change the view or do any filtering you can see that the ID is really just the row number. Can I get the actual item's GUID here?
If I can get the item's ID I can send it with the list ID to an application page that will get the right URL from field in the list and forward the user on to the right site.
I think the easiest solution and one I use regularly to modify default sharepoint functionality without having to install server side code is to inject some javascript onto the page to make the necessary modifications.
The Content Editor webpart is ideal for this if you don't want to edit the page source itself. Together with the IE Developer Toolbar or Firebug to inspect the elements you want to edit you should be able to achieve what you need with just a couple of lines of javascript.
Let me know if you need any further detail on getting this work.
The title/link to edit menu is a computed field - basically a combination of the title and item id. If you look at the definition of the field (off the top of my head I think it's in fields.xml) you should be able to create a modified version in your schema.xml that uses the url field in its RenderPattern.
Following up on Tom's answer, you can use the SharePoint Solution Generator in VseWss 1.3 to generate a Visual Studio solution that can re-create your list. You will faint when you see the huge amount of XML that the views use in the schema.xml file but you will see the render pattern that Tom referred to and you should be able to get a general idea of how to modify it to suit your needs.
Gotta love SharePoint. Where small customizations means "take what I give you or rewrite it from scratch"