Sunday 24 April 2016

K2 Workflows not sending Notification mails and Email event mails



I had been challenged with a major issue. K2 workflows never sent mails. Not via the inbuilt notification for events, or via the “send Mail” activity.
Now the K2 server had been integrated with MS Exchange 2013. From these servers, mails could be sent and received via OWA. However, they never get sent from a K2 workflow.


Find below what I did to resolve this issue.

Steps I carried out OVER AND OVER AGAIN.
I had run
  1. Configure – re-configure
  2. Repair

On k2 black pearl setup manager and when it prompted for the exchange integration I had input the correct EWS url, "from address", and even tested (which passed) for auto discover.

I had inspected the ConnectionStringEditior.exe located at “C:\Program Files (x86)\K2 blackpearl\Host Server\Bin” to ensure the entries were correct.

I copied out the K2HostServer.exe.config file, and inspected the values to be sure the “from address” was not wrongly registered.


None of the above seemed to resolve the issue.

It so happened that my problem had two major culprits.
  1. Environmental fields
  2. MSMQ

Before now, I resolved to enable exceptions whenever notifications and emails were sent in workkkflows. However I now decided to log them to the event log and server. I found from the error logs, that the “From Address” was actually wrong.

It complained of “mailId@DomainName” (, rather than mailID@DomainName.DomainSuffix)  not having a “Send on behalf of” permission on exchange. 

Since I was sure I had the correct mail input in K2 Black pearl setup manager, as well as it rightly  represented in the connection string editor, I was prompted to look into K2 workspace manager.

From K2 workspace, I navigate thus:
 ServerName > Environment Library> Templates > Default templates >Environments > Development/Production >Environment fields

There I corrected the “from address” and redeployed the workflow. That resolved the issue with workflow “Email Event” not sending mails.
Here ended culprit number one.

Notifications still yet to be sent
There however was another issue on ground, notifications not being sent. K2 notifications are handled by the Message Queuing service. Over the time, I kept getting error events in the event logs as regards message queuing. Always unable to create queues (which are meant to push the notifications)
At the final analysis of configuration manager being run all the time, I get an error on MSMQ

“Message Queuing Enabled
Analysis Result: failed
MSMQ Directory Service Integration has been detected on this system

MSMQ Workgroup flag in the registry is incorrect, its value should be 0 for domain machines”

We always went and changed the registry value (which can be found at Computer\HKLM\Software\Microsoft\MSMQ\Parameters) from 1 to 0, but realize it always swung back to 1, and re-analysis always failed. I tried changing from public queues to private queues. That also was as futile as changing the workgroup values, as it always switched back to public. It was almost like a crazy loop of dead end.

 In all that is done, it happens that the system runs MSMQ in workgroup rather than domain mode. That’s to say that, MSMQ thinks the computer is a workgroup system(funny ain't it?), while K2 knows the computer is a domain computer. So there went the confusion.

The explaination to this is that that MSMQ was installed before the machine(which was theen a workgroup) was promoted to a domain computer. Hence, there went the “message queuing” culprit that stalled all notification mails. So I granted the NETWORK service full control in AD users n computers.
How to grant Network Service full control
  1.  Open AD Users and computers
  2. Expand your domain node
  3. Click on “domain controllers
  4. Right click computer name, select “properties
  5. Select security tab, under group or user names, add NETWORK SERVICE, and grant full control.       
 After that,
  1. I uninstalled MSMQ,
  2. Restarted the machine,
  3.  Restarted it again when the second stage of uninstalling was complete. (I skipped this step severally, and had to perform the entire operation over and over without success)
  4. Then I installed back the MSMQ.4.       


Now the registry value was corrected as 0 (Logic: you can never manually change this value, it automatically changes at each restart. You have to make sure the value is registered correctly at MSMQ installation).

After that, I went back to environment settings and made the  “from Address” the default (rather than “mail server” smtp address).
 Immediately this was done, the notification mails were sent.
There ended culprit number 2

Saturday 24 January 2015

The issue with 'R cannot be resolved to a variable' - Android Application Development

This small but mighty error gave me 4 hours of headache. Missing R.Java file in the ‘gen’ folder, and encountering ‘R cannot be resolved to a variable’ each time I try to run the application.


Every single article I read said everything you already there was to say.
  1. Check if you have import android.R ; and delete it. Next clean the solution and rebuild. If it still is missing, restart eclipse.
  2. Make  sure your SDK manager is up to date and install the latest SDK Build tools.
  3. Check all the XML file names in the res folder and make sure they are all in lowercase convention. Then clean/build and restart eclipse.
  4. Inspect the AndroidManifest.xml and other xml files to ensure there are no errors and the suggestions go on and on and on……...
I tried all these and more, deleted and recreated my whole project severally. Still no positive result. The R.Java file just refused to appear in the package under the ‘gen’ folder.

 In fact, as opposed to others who initially had this file but it later disappeared (hence right clicking the ‘gen’ folder and selecting ‘Restore from Local History’ could resolve their issue due to the fact that the R.Java file might have been deleted), mine NEVER was created at all, even after deleting and re-creating new projects

Now I had ADT version 23 with highest API level of 21 (Android 5.0.1).

On creating the project, I was provided with drop downs “Target SDK” and “Compile With” where from which I was to select an API level. Not selecting the highest API level in both instances made the issue with R.Java file not being created and anywhere R was referenced in the program, it could not be resolved.

So I had to SELECT THE HIGHEST API LEVEL I HAD Installed and voila!!!!! Problem solved. 





For Target SDK, select highest API you have installed



Similarly for Compile With, select highest API you have installed



I hope this gives you one less headache.

Wednesday 12 February 2014

RESTRICTING VISIBILITY OF SHAREPOINT LIBRARY VIEWS

Hello Pals,

Ever been stuck with wondering how on earth to have a sharepoint library display certain information to only who you want? Here is a small scenario.

I have a sharepoint Form or Document Library. I need for users to be only able to view items created by them, or assigned to them. But I do not want them to be able to view all documents via the "All Documents" link. Here is what needs to be done.

1. Have a new view created, name it "My Forms" or  "My Documents"view. In the Filter section select "Show items only when the following is true:"  then show items when column "Created By" is equal to "[Me]".


2. Switch this new view to your default view. This automatically strips the "All Documents" view from being the default.

3. Now each view you create is actually an aspx page as you can see from the web address url .eg http://mysharepointsite/myformlibrary/forms/viewname.aspx . So make sure you have selected your "All Documents" view (Which of course is no longer your default view). Edit the page,

 you can see that this view is a web part in the content editor. 

4. Edit the web part. 

Under the advanced tab, you would see "Target Audiences". Here, you would enter a sharepoint group you must have previously created, and to which you have added the users alone who should see "All Documents". 


5. Apply your changes, and save.


When anyone navigates to the Form/Document library, they would see the "My Forms" or  "My Documents" view by default, and even if they try to switch to the "All Documents" view, the list view will display nothing to them.

However, if you apply target audiences on the "All Documents" view, while it is still the default, users who are not members of the audience would see nothing when they visit the library. So make sure you have stopped it from being the default view.

Wednesday 4 December 2013

Error Deploying Visual Studio Workflows: Assembly signing failed


Hello Guys.

I had this C# Visual Studio 2013 code which was already in use, I had made modifications to it and it really needed to be deployed. But Alas, I click on "Deploy" and get the error message below

Error 1 Assembly signing failed; output may not be signed -- Error signing assembly -- The process cannot access the file because it is being used by another process.  {SolutionName}


I stopped for a moment to think what was done wrongly. I tried Cleaning, Rebuilding, Closing and Reopening the solution. But Alas, to no avail.

Then I checked all the opened projects and found out that the same signed on user had opened the same project solution. So all I had to do was close the close other opened project solution with the same name, deployed, and Viola, ERROR DISAPPEARED

So whenever you come across this such errors, check your opened projects.


Friday 18 October 2013

CREATING A SHAREPOINT 2013 FARM USING SQL ALIASES, FROM POWER SHELL


You may be very well used to creating your SharePoint farm simply by running configuration wizard.

Here is a way to create it using PowerShell, and an already created SQL Server Alias.


1.  Open SharePoint 2013 management shell as administrator.
2.  You will see this error message at the top: “The local farm is not accessible. 
     Cmdlets with FeatureDependencyId are not registered.” Do not panic. This is expected because a                farm has not yet been created.

3.  Type in the following PowerShell command at the prompt, and press enter
“New-SPConfigurationDatabase -DatabaseName SharePoint_Config -DatabaseServer MSSQLSERVERTEST_ALIAS -AdministrationContentDatabaseName SharePoint_Admin_Content”
Where MSSQLSERVERTEST_ALIAS is the sql server alias you would have created on your SharePoint server
NB: Change the databsase server name to the name of the database alias you have created.
Check here on howto create SharePoint SQL server database aliases.

4.  You would be immediately prompted to enter your farm credentials. This credentials are the a                       account you want as farm admin account. For me it’s sp_farm.

 5.  Next you will be prompted for passphrase. Clear the existing ****************** which you see(if it       pops up), and enter any value you wish as your passphrase. Remember it well, as it would be 
       needed should you have cause to join another server to the farm.

You may get an error stating
“Cannot connect to database master at sql server < MSSQLSERVERTEST_ALIAS> { ie  <ServerAliasName>. The database might not exist, or current user might not have permission to connect to it.



If you get this error, continue with step 6. Else proceed to steps 10

6.  Try to verify that the error has nothing to do with your PowerShell commands, try creating the farm 
            using SharePoint configuration wizard.

 7.  If the error persists, then check that your alias was created properly. Check here on how to createSharePoint SQL server database aliases.
8.  If the SQL Aliasing part is ok, then confirm that the account you are creating the farm with, which                 you must have also installed SharePoint with (now this is not the account you provided as farm admin            account, but the account you ), which is “adminsp” in my case, has the following permissions in the                database server “dbcreator”, ”security admin”. Go to your sql server, connect to your instance, and          expand Security > Logins, then right click on this account, select server roles. Then give the appropriate        permissions.






9.  If this is in place, and the error still persists, ensure that you don’t have firewall turned on. If they                   are, create a windows firewall rule on you sql server. Go to your Windows firewall on your SQL                   server, on the left, click on ”advanced settings”. Select “Inbound Rules” > “new rule”. For the rule type,         select “port”. For the Protocol and ports, Select TCP, then enter your sql specific port number. Action,         select “Allow this port number”. Select the profile, then Give the rule a name that you can remember.


10.  With all these in place, you should be OK with proceeding with your farm creation. This should create 2         database tables for you “SharePoint_Config” and “SharePoint_Admin_Content”.

11.  When your PS commands are done with the farm creation, the cursor would return to its blinking state.

     12.  Next, open SharePoint 2013 products configuration wizard and run the wizard. When prompted for port       number, specify the port number you want for your SharePoint central administration and select NTLM         Authentication.

Tuesday 8 October 2013

CREATING A SHAREPOINT SQL SERVER ALIAS



What is an SQL Alias? 

This is a name used to reference your database, via which any application connecting to the database can connect. So if you have say, a SharePoint farm, that needs to access your SQL server, rather than point the SharePoint farm to the actual database name, you could create an alias, to which you will point the SharePoint server. It is this alias that would in turn, point to the actual SQL server.

Why the need for an SQL alias?

Should there be any need whatsoever for your SQL server to be changed, if you want to use a different server there would be confusion on the SharePoint server, because the farm would look for its existing databases and not find them. The initial server name used would have registered itself everywhere on the farm, and this cannot be changed.
I hear someone say, if the need for this arrives, I’d provision a new SQL server with the same server mane as the previous, and same instance name or cluster name as the previous. While this might prove a solution to this case, it should also be worthy of note that this could be time consuming, time which may not be a readily available might have to be expended. Also, the old server might still be used by other applications.
To curb all these, it is necessary to create an alias, when creating a SharePoint farm for the first time, use the alias name as the SQL server name. So if there is the need for the server hosting SharePoint to change, the appropriate databases are backed up from the old server, and restored to the new one, then the alias pointing to the old server now points to the new server.

To create an SQL alias, you have to run both the 32 and 64 bit SQL tool.      

1.       RUN THE 32 BIT SQL TOOL

          C:\windows\system32\cliconfg.exe
On the general Tab, ensure that TCP IP is enabled 




Next, go to the “alias tab” and select “add”.



Then enter the name you wish to use as alias, and your actual server instance name or cluster name. Also enter your port number.



(In the event that you have to change your SQL server, it is in this “Server name” text box you would have to enter the name of the new server, so even if SharePoint still has the alias name, it points to this new server).

To get your port number, run the SQL server configuration manager tool.

SQL Server Network Configuration > Protocols for [SQLSERVERNAME], select TCP IP, click on the
IP addresses tab. Then check the port number from the “TCP Port” section.



2.       RUN THE 64 BIT SQL TOOL

      C:\windows\SysWOW64\cliconfg.exe, and repeat all the steps done for 32 bit tool.


When you are done with that, run the SQL server configuration manager.
Go to SQL Native Client 11.0 Configuration> aliases. Right click alias, select new, and then enter the values.


When done with that, it should look somewhat like this.


Repeat same process for SQL Native Client 11.0 Configuration (32 bit)
Then you can use the alias in place of the SQL server\instance name whenever you need to refer to the server. In the creation of a SharePoint farm, this name could be used.
Now, here is a bit of an over sight that really gave me a night of headache when creating my SharePoint farm. For those using a cluster, this might not be much of a trouble. But here I was using a SQL server name\instance name.
I kept getting the error:
“Cannot connect to database master at sql server < MSSQLSERVERTEST_ALIAS> { ie  <ServerAliasName>. The database might not exist, or current user might not have permission to connect to it.

I thought there was something wrong with my PowerShell scripts. So I decided to create the farm using farm configuration wizard.
But lo, same problem persisted. After a whole night of time wasting, I found out that when registering my aliases on my WFE server, I used just instance name


Rather than server name\instance name.


This is what my connection to SQL looks like


So unless you are using an SQL cluster (where you would then have to enter your cluster name), in the place of server name, do ensure to enter your server name\instance name. Else you want to waste a whole lot of time trouble shooting.

Good luck.