Tuesday, January 3, 2017

How to skip an edit form after uploading a single document in SP 2013

How to skip an edit form after uploading a single document in SP 2013

I would like to set all document properties programmatically inside the event handler. i do not manage to skip an edit form after the document is uloaded.

Solution :

Javascript solution for sharepoint 2013


In SP.UI.Dialog, there is a function to close a dialog : commonModalDialogClose
Takes two parameters, commonModalDialogClose(dialogResult, returnValue)
dialogResult is an enum (here is an extract from SP.UI.Dialog.js :
SP.UI.DialogResult.prototype = {
    invalid: -1,
    cancel: 0,
    OK: 1
};
Solution : When using the upload.aspx page, you will be redirected to the EditForm.aspxincluding a QueryString parameter, Mode, that will be tagged as Upload. Using that information, the dialog can be closed. The QueryString parameter is retrieved using the GetUrlKeyValueSharePoint native function.
GetUrlKeyValue(keyName, bNoDecode, url, bCaseInsensitive)
add the following into the library EditForm.aspx using JSLink
(function (){
    var mode = GetUrlKeyValue("Mode", false, window.location.href, true);

    if (mode == "Upload")
    {
        //commonModalDialogClose(dialogresult, resultValue)
        //dialog result : -1 = invalid; 0 = cancel; 1 = ok
        //resultValue : text
        commonModalDialogClose(0, null);
    }
})();
Hope this help,

Friday, November 25, 2016

Project server 2013 : cannot create view


Project server 2013 : cannot create view


Hi,

I installed Project server 2013 on a SharePoint 2013 farm , I follow best practice recommendations
, everything goes well until I tried to create a new view from the "Project Web App Settings" page ==> the view doesn't get created and the browser consol displays an internal server error 500!!

After verification on sharepoint logs ==>I did found nothing, oh :o

After many hours of invistigation, i finally did found a warning on the event viewer ==> good news :/



 Event code: 3003 
Event message: A validation error has occurred. 
Event time: 24/11/2016 11:49:00 
Event time (UTC): 24/11/2016 10:49:00 
Event ID: f1579d278df048f480b1deee3faa1c49 
Event sequence: 245 
Event occurrence: 15 
Event detail code: 0 
Application information: 
    Application domain: /LM/W3SVC/1513911398/ROOT-2-131244510754673622 
    Trust level: Full 
    Application Virtual Path: / 
    Application Path: C:\inetpub\wwwroot\wss\VirtualDirectories\443\ 
    Machine name: VMXXXXSPO 
Process information: 
    Process ID: 5128 
    Process name: w3wp.exe 
    Account name: Domain\XXXX
Exception information: 
    Exception type: HttpRequestValidationException 
    Exception message: A potentially dangerous Request.Form value was detected from the client (ctl00$ctl00$PlaceHolderMain$PWA_PlaceHolderMain$idGroupingSortingParams="<VIEW><GRPBY0>0</GRP...").
   at System.Web.HttpRequest.ValidateString(String value, String collectionKey, RequestValidationSource requestCollection)
   at System.Web.HttpRequest.ValidateHttpValueCollection(HttpValueCollection collection, RequestValidationSource requestCollection)
   at System.Web.HttpRequest.get_Form()
   at Microsoft.SharePoint.SPGlobal.GetParametersFromHttpRequest(SPSite site, Boolean bAuthenticated)
   at Microsoft.SharePoint.SPGlobal.CreateSPRequestAndSetIdentity(SPSite site, String name, Boolean bNotGlobalAdminCode, String strUrl, Boolean bNotAddToContext, Byte[] UserToken, SPAppPrincipalToken appPrincipalToken, String userName, Boolean bIgnoreTokenTimeout, Boolean bAsAnonymous)
   at Microsoft.SharePoint.SPWeb.InitializeSPRequest()
   at Microsoft.SharePoint.SPWeb.EnsureSPRequest()
   at Microsoft.SharePoint.WebControls.SPControl.EnsureSPWebRequest(SPWeb web)
   at Microsoft.SharePoint.WebControls.SPControl.SPWebEnsureSPControl(HttpContext context)
   at Microsoft.SharePoint.SPContext.get_Current()
   at Microsoft.Office.Project.PWA.PJBasePage..ctor(String pwaUrl)
   at Microsoft.Office.Project.PWA.PJWebPage..ctor(String url)
   at __ASP.FastObjectFactory_app_web_viewsaddmod_aspx_ad835a1b_jhjrehvf.Create_ASP__layouts_15_pwa_admin_viewsaddmod_aspx()
   at System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp)
   at System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath)
   at System.Web.HttpApplication.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

Request information: 
    Request URL: https://XXXX.XXXX.com:443/_layouts/15/pwa/Admin/ViewsAddMod.aspx?idTableUID=&idViewType= 
    Request path: /_layouts/15/pwa/Admin/ViewsAddMod.aspx 
    User host address: 66.160.201.34 
    User: 0#.w|XXX\sp_sql 
    Is authenticated: True 
    Authentication Type: Federation 
    Thread account name: XXXX\sp_sql 
Thread information: 
    Thread ID: 715 
    Thread account name: XXXX\sp_sql 
    Is impersonating: True 
    Stack trace:    at System.Web.HttpRequest.ValidateString(String value, String collectionKey, RequestValidationSource requestCollection)
   at System.Web.HttpRequest.ValidateHttpValueCollection(HttpValueCollection collection, RequestValidationSource requestCollection)
   at System.Web.HttpRequest.get_Form()
   at Microsoft.SharePoint.SPGlobal.GetParametersFromHttpRequest(SPSite site, Boolean bAuthenticated)
   at Microsoft.SharePoint.SPGlobal.CreateSPRequestAndSetIdentity(SPSite site, String name, Boolean bNotGlobalAdminCode, String strUrl, Boolean bNotAddToContext, Byte[] UserToken, SPAppPrincipalToken appPrincipalToken, String userName, Boolean bIgnoreTokenTimeout, Boolean bAsAnonymous)
   at Microsoft.SharePoint.SPWeb.InitializeSPRequest()
   at Microsoft.SharePoint.SPWeb.EnsureSPRequest()
   at Microsoft.SharePoint.WebControls.SPControl.EnsureSPWebRequest(SPWeb web)
   at Microsoft.SharePoint.WebControls.SPControl.SPWebEnsureSPControl(HttpContext context)
   at Microsoft.SharePoint.SPContext.get_Current()
   at Microsoft.Office.Project.PWA.PJBasePage..ctor(String pwaUrl)
   at Microsoft.Office.Project.PWA.PJWebPage..ctor(String url)
   at __ASP.FastObjectFactory_app_web_viewsaddmod_aspx_ad835a1b_jhjrehvf.Create_ASP__layouts_15_pwa_admin_viewsaddmod_aspx()
   at System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp)
   at System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath)
   at System.Web.HttpApplication.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

So what does this error mean? Just googled and found some interesting answers for this problem :

Server error in application ... A potentially dangerous Request.Form value detected...

Cause :

The .Net Framework is throwing up an error because it detected omething in the entred text which looks like an HTML statement, like a brackets "<  >".

Hmm, 

The reason behind the error is as a security precaution. Developers need to be aware that users might try yo inject HTML into the URL which may affect how the form is rendred. For further details www.asp.net/learn/whitepapers/request-validation/.


To resolve this problem,  the "ValidateResuest" needs to be set to "false" so that the postback validation does not occur.

To disable request validation follow the steps below : 

     * Locate the "web.config" file and locate a line which may look like the following :


<pages validateRequest="true" enableEventValidation="false" />
    * Change the "validateRequest= "true" to "false"
    * Restart the IIS

If you are using framework 4.5 then entry in web.config (requestValidationMode = "2.0")


<system.web>
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5" requestValidationMode="2.0"/>
</system.web>

Et voilĂ !

Hope this helps,
Oumaima

Monday, November 21, 2016

SharePoint Incoming e-mail - show the sender as a column

SharePoint Incoming e-mail - show the sender as a column

Scenario: In a SharePoint email enabled list, receive emails from an external sender and display the from address as a column.

For email enabled lists, there is a column called e-mail sender as per extract from MSDN article below. The tricky part is that it does not show up as a column in the library settings. Just go to "Modify this view" and select these columns to be shown.


The following fields are mapped from an e-mail message to a list: E-Mail Sender, E-Mail To, E-Mail Cc, E-Mail Subject, Body of the message, and attachments.

http://office.microsoft.com/en-au/sharepoint-server-help/introduction-to-incoming-e-mail-HA010082306.aspx

Hope this help,
Oumaima

Tuesday, October 25, 2016

Waiting for Resources? – What happens when you provision a new Project Web Access site

Waiting for Resources? – What happens when you provision a new Project Web Access site

One problem I have seen a few times is the Project Web Access site provisioning running into issues.  If it fails completely then the error messages are pretty good – and you can generally resolve the issue and re-try and everything will be good.  
However, what do you do when it just sits on “Waiting for Resources” and nothing happens?  The quick answer is that this relies on the SharePoint Timer Service and a couple of Shared Service Provider services that can be viewed through Timer Job Definitions (Shared Services Timer Job and Project Server Synchronizing Job for ‘SharedServices1’ – or whatever yours is called). 
If these are not running then you will be “Waiting for resources” for a very long time!  Also there could be multiple versions of the timer jobs if you have multiple SSPs so it can get confusing, particularly as the first one does not differentiate by name.  (Clue – the JobId in the URL for the job is the Id of the timer job row in the Objects table in SharePoint_Config database, and the Properties column from this row will lead you to the Guid of the TargetSharedResourceProvider – which will be the Id of the Shared Services Provider also in the same table.)
So to dig a little deeper so you can understand where it might be stuck I’ll explain what is going on in the background which hopefully will help you find what is stopping it from working.
So, step 1 – you have been on the Create a Project Web Access Site page (CreatePWA.aspx) and entered all the details, and it goes back to the Manage Project Web Access Sites (ManagePWA.aspx) page and just sits there.  At that point a row has been added to the MIPScheduledJob table in the SharedService1_DB (your database name may vary – this is the default).  This is a pre-synchronizing job for the site, and is added to the database by the account running the Shared Services Provider application pool.
Step 2.  The Shared Service Timer Job picks up the row from this database table and adds a row to the SharePoint_Config database Objects table.  In the properties field of this table is some XML describing the site to be built, database names etc.  This timer job will run as the account of the farm administrator (i.e. the account running the OWSTIMER service)
Step 3.  The Project Server Synchronizing Job for ‘SharedServices1’ sees this row and actions it by creating the site, creating the database and then configuring the instance of PWA.  If everything is working you see the status change on the ManagePWA page as these different stages are processed, and finally it will say Provisioned!  Again, this timer service runs as the farm administrator.
Waiting for resources will be seen until the early stages of step 3.
So check all your services are running and your timer jobs are present and enabled and all should be good.
One other workaround that generally gets things moving again is to create  a new Shared Services Provider – which will then create new timer jobs and overcome any underlying issues.  The web applications can then be associated with the new SSP, the new SSP can be made the default if you are not using the old one for anything else, and the old one could be deleted.
I mention the databases here on the condition that you can look – but don’t touch! 
Hope this help,
Oumaima

Friday, October 21, 2016

Install and Configure Workflow For SharePoint Server 2013

Install and Configure Workflow For SharePoint Server 2013

Introduction 
The only platform available when you first install SharePoint Server 2013 is the SharePoint 2010 Workflow platform. The SharePoint 2013 Workflow platform and the Project Server platform require additional steps.

The SharePoint 2010 Workflow platform installs automatically when you install SharePoint Server 2013. The SharePoint 2013 Workflow platform requires the Workflow Manager and must be installed separately and then configured to work with your SharePoint Server 2013 farm.

The Workflow Manager is a new kind of application server that hosts/manages workflow execution. The SharePoint 2013 workflow is based on the .Net Framework 4.0.

Now we will learn the procedure for installing and configuring the workflow.

In the first step open the Web Platform Installer and add the Workflow Manager 1.0.

Add the Workflow Manager

Click on the "Install" button;

Install button

Then "Continue".

Install continue

The next step is the Workflow Manager configuration wizard. We have three options here to configure the workflow. Here I am selecting the second option "Configure Workflow Manager with custom setting".

workflow manager configuration

Enter the credentials here:

credentials

Click on "Next".

Next Step

Enter the certificate credentials.

certificate credentials

Service Bus Configuration steps:

Service Bus Configuration

Configure the certificates,

Configure the certificates

Get the summary of the configuration.

summary of the configuration

Get the PowerShell Commands for the configuration.

PowerShell Commands

Configuration progress window:

Configuration progress window

And we have the option for updating the configuration.

update the configuration

Looking goodAfter the preceding steps, open the IIS and we can see the new WorkflowManagement Site has been created.

open the IIS

We need to check that the new service Workflow Manager has been started.

new service Workflow manager

The new tables are created in the SQL Server.

tables created in the SQL Server

Run the following command in the SharePoint 2013 Management Shell:
 
Register-SPWorkflowService -SPSite http://sptest/ -WorkflowHostUri http://sptest:12291 -AllowOAuthHttp 

Run the command in SharePoint Management Shell

We have now completed the workflow configuration, open the SharePoint designer and create a new workflowYes here we have the options for creating a SharePoint 2013 Workflow.
completed the workflow configuration

That it!

Hope this help,
Oumaima,

“Sharepoint 2013 Workflow - Project Server” not showing in SharePoint Designer

“Sharepoint 2013 Workflow - Project Server” not showing in SharePoint Designer

You have to use a 'Site Workflow' in order for the option to appear for Project Server.

Hope this help,
Oumaima

Failed to register because the farm or partition is already registered with a workflow service

Failed to register because the farm or partition is already registered with a workflow service

I was recently training a colleague on administering SharePoint and he was encountering issues with being unable to publish SharePoint Workflows after he applied an SSL certificate to his SharePoint site.

Well, immediately after checking his IIS bindings and his AAM settings, the next thing I thought of was that he would have to re-register his SharePoint site with the Workflow Service.

Of course, he ran the following command:

Register-SPWorkflowService -SPSite "https://spse/sites" -WorkflowHostUri "https://spse:12290" 

But he received the following error message: 
Failed to register because the farm or partition is already registered with a workflow
service


Well, fortunately, there was an easy solution to this!!  All he had to do was run the command with the -Force parameter:

 Register-SPWorkflowService -SPSite "https://spse/sites" -WorkflowHostUri "https://spse:12290" -Force

That was all that was needed to resolve his issue!! 


Hope this help,
Oumaima