What a day, searching for several hours to found out how it come's
that the attachment functionality didn't work at a custom aspx webpart page.
After searching and searching I found the solution.
You may not use New/Edit/Display Form directly from your list, but use it via the Custom List Form.
Otherwise the Attachment functionality will not be provided and I hadn't found
a way to let it functioning.
So far even that I didn't got an error message anymore and that the attachment
wasn't saved into your item.
So how to do it... Follow these steps:
1. Create a custom list.
2. Open that site in SharePoint designer,
and create a new web part page in Site Page,
then open it in advanced mode.
3. Then new web part page is opened.
Click Insert > New Item Form > Custom List Form >
Select that custom list to use for form >
Select Item content type to use for form >
Select New item form to create >
Keeping Show standard toolbar is checked > Click OK.
Then I can get a SharePoint:FormToolBar with Attach File and Spelling options.
Then save and preview this page, you can see the toolbar in the ribbon is enabled.
Go back to the web part in SharePoint Designer,
and delete the SharePoint:FormToolBar control,
save the page and preview it, we can see,
the toolbar with Save, Cancel, Paste and Attach File buttons is disabled.
donderdag 2 augustus 2012
Custom Webpart Page with Attachments
Labels:
ASPX,
Attachments,
Custom Page,
List,
List Item,
Webpart
donderdag 5 juli 2012
Workflow with Impersonation Step and his Publisher
Important to know if you use an impersonation step in a workflow, and you change the rights of
the user that has published the workflow, the workflow will start failing to execute his code.
Last week we cleaned up some user accounts of employees that din't work any more in the company
and suddenly we remarked that certain workflows were not working any more.
The workflow impersonates the "Author" from a SharePoint point of view for that step.
So if she somehow looses her rights if'll fail.
The reason I'm putting "Author" in quotes is that in my option it's a wrong term,
because in fact it's the last publisher's identity which is used.
So if the workflow fails due to the "Author" loosing the rights any user with sufficient rights
can go in and publish the workflow and it'll start working again.
In fact you can do this as a general rule and have some "service account"
which is used to publish all workflows so they'll run with the permissions of that account
which should then not be a real person.
Labels:
author,
impersonation,
publisher,
Security,
workflow
zondag 24 juni 2012
Value of approvalStatus changes in function of MUI Language
Believe it or not, but I was supprised that technical fields from Sharepoint are translated when
you change your MUI Language.
I discovered it by accident when a user called me, that my draft image was always visible
even when the document was approved.
So after some debugging I saw that the approvalStatus field of sharepoint was translated in the
language of the MUI.
In our configuration, we have English, Dutch and French. So the approvalStatus field is getting
in English the value "approved", in Dutch : "goedgekeurd" and in French : "approuvé" !
If you do equal stuff, I have coded next script in a Content Editor Webpart for my users :
//show draft image if topic is not approved
if (document.getElementById('approvalStatus').innerHTML.toLowerCase() == 'approved'
|| document.getElementById('approvalStatus').innerHTML.toLowerCase() == 'approuvé'
|| document.getElementById('approvalStatus').innerHTML.toLowerCase() == 'goedgekeurd')
{
document.body.background = '';
}
else
{
document.body.style.backgroundPosition="center";
document.body.style.backgroundImage="url(../../SiteCollectionImages/watermark-draft.png)";
document.body.style.backgroundRepeat="no-repeat";
}
Labels:
approvalStatus,
javascript,
JQuery,
Language,
MUI,
SharePoint,
SharePoint Designer
Get User Roles, Security groups on Client site
Last week I figgered out how to know in which security group the logged-on user has access to
in order to show or hide some fields or ribbon items.
For example to prevent to show All Site Contents in the action menu.
Below some code that does the work for you... have fun with it ;)
<script src="/scripts/jquery-1.7.min.js" type="text/javascript"></script>
<script src="/scripts/jquery.SPServices-0.7.0.js" type="text/javascript"></script>
<script type="text/javascript">
getCurrentUserRole();
function getCurrentUserRole() {
$().SPServices({
operation: "GetGroupCollectionFromUser",
userLoginName: $().SPServices.SPGetCurrentUser(),
async: false,
completefunc: function (xData, Status) {
if( Status == "success") {
//alert(xData.responseText);
$(xData.responseXML).find("Group").each(function () {
if ($(this).attr("Name") == "DevSite Owners")
{
alert("write access");
}
else
{
// wrong access hide some stuff... for example the Site Action link.
$("#siteactiontd").hide();
// hide the global navigation folder
$("#GlobalBreadCrumbNavPopout-anchor").hide();
}//alert($(this).attr("Name"));
});
}
}
});
}
</script>
Labels:
HTML,
javascript,
JQuery,
Roles,
Security,
SharePoint
Refinements, "Show More" link stopped working
I recently discovered that the “Show More” link on the Search Refinement Panel web part had stopped working, seemingly out of the blue. With a bit of debugging I discovered that the functions defined in the onclick event: onclick="SearchEnsureSOD();ToggleRefMoreLessFilters(this, true);" were returning “Object Expected”. For some reason the functions were no longer defined. I eventually figured out that the problem was that I had removed the Search Box web part from the page and replaced it with my own custom search box. Apparently the Search Box web part is required on the same page as the Refinement Panel web part, as it injects JavaScript into the page that is used by the Refinement Panel. I fixed the problem by adding the Search Box web part back onto the page and hiding it.
Labels:
Core Search Result,
Error,
Hyperlink,
Object Expected,
refinements,
Search,
SearchEnsureSOD
donderdag 14 juni 2012
SharePointblog.co.uk is doing a 100 days/100posts on Business Analysis
Yust saw next big news in Balestra's Blog :
The people over at SharePointblog.co.uk are going to post 100 blogposts in the next 100 days
about Business analysis to improve SharePoint requirements gathering.
Some will be quick tips, other big posts.
They also have a twitter hashtag: #bamasterclass .
Don't miss it!!
Check if Sharepoint Richt Text Editor Field is empty or not
Today I had some problems to do a check wether a Rich Text Editor field is filled in or not.
I found out that sharepoint also translates the Title of the Rich Text Editor field.
That was really unexpected because the iframe is dynamically constructed in the browser.
So you would expect that changing the MUI language would translate the
Title propertie of the RTE field.
So for Frensh, Dutch and English MUI languages you could do the check like below.
var scomments = "";
if (_spPageContextInfo.currentLanguage == 1036) {
var systemDescriptionRTE = $("textarea[Title='Comments']").closest("span").find("iframe[Title='Éditeur de texte enrichi']").contents().find("body");
scomments = $(systemDescriptionRTE).text();
}
else
{
if (_spPageContextInfo.currentLanguage == 1043) {
var systemDescriptionRTE = $("textarea[Title='Comments']").closest("span").find("iframe[Title='RTF-editor']").contents().find("body");
scomments = $(systemDescriptionRTE).text();
}
else
{
var systemDescriptionRTE = $("textarea[Title='Comments']").closest("span").find("iframe[Title='Rich Text Editor']").contents().find("body");
scomments = $(systemDescriptionRTE).text();
}
}
Bugfix available at this new blogpost :
http://andydevelopments.blogspot.com/2012/10/check-if-sharepoint-richt-text-editor.html
Labels:
IsEmpty,
javascript,
JQuery,
Rich Text Editor,
SharePoint
Abonneren op:
Posts (Atom)